1,105,310 Community Members

LOCALHOST-PHP in browser

Member Avatar
wavyaquaeyes
Newbie Poster
20 posts since Feb 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
1
 

HELP- I need to view my php files in the browser. I am running Apache server.

I know only this much to put in the browser
http://localhost/ /filename.php

thanks

Member Avatar
jbennet
Moderator
17,127 posts since Apr 2005
Reputation Points: 1,618 [?]
Q&As Helped to Solve: 736 [?]
Skill Endorsements: 38 [?]
Team Colleague
Featured
 
0
 

umm do you have PHP installed and configured?

Member Avatar
wavyaquaeyes
Newbie Poster
20 posts since Feb 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

yes to both

Member Avatar
jbennet
Moderator
17,127 posts since Apr 2005
Reputation Points: 1,618 [?]
Q&As Helped to Solve: 736 [?]
Skill Endorsements: 38 [?]
Team Colleague
Featured
 
0
 

so the files are in the directory on the web server? (usually /var/wwwroot on linux)

if so you should just do:

http://localhost/pagename
or

http://127.0.0.1

Member Avatar
desiguru
Junior Poster in Training
63 posts since Aug 2006
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

Install wamp server and then try it. WAMP is really easy to use.

Member Avatar
wavyaquaeyes
Newbie Poster
20 posts since Feb 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

thanks a;; appreciate it

Member Avatar
desiguru
Junior Poster in Training
63 posts since Aug 2006
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

thanks a;; appreciate it

Also if you want to learn more about php you should watch Lynda.com's php beginner's tutorial. It's amazing.

Member Avatar
omesa
Newbie Poster
21 posts since Jun 2006
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hello, Concerning the files, you need to put your files in a folder called "htdocs" where you installed the apache webserver
for example my files are in c:/program files/apache group/apache2/htdocs/folder name/
so I on my browser I type
http://localhost/foldername/filename

but first check if the server is running.

Member Avatar
jbennet
Moderator
17,127 posts since Apr 2005
Reputation Points: 1,618 [?]
Q&As Helped to Solve: 736 [?]
Skill Endorsements: 38 [?]
Team Colleague
Featured
 
0
 

or if its linux then its usually /var/www

Member Avatar
2easy4bee
Newbie Poster
1 post since Apr 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I have my index.php file in folder aldo on drive D. here is the detail
D:\PHP\www\aldo\index.php. what should i write on address browser to run this index, or should I need to create new folder ?? should I set the server (appserv) ??
Your assistance really much appreciated

Regards
Leonardo
<EMAIL SNIPPED>

Member Avatar
Ezzaral
Posting Sage
7,431 posts since May 2007
Reputation Points: 2,714 [?]
Q&As Helped to Solve: 953 [?]
Skill Endorsements: 31 [?]
Moderator
Featured
 
0
 

localhost/aldo/index.php should suffice.

Member Avatar
martin5211
Posting Whiz in Training
271 posts since Aug 2007
Reputation Points: 37 [?]
Q&As Helped to Solve: 24 [?]
Skill Endorsements: 0 [?]
 
0
 

If the page only shows the code that's because the PHP interpreter isn't running. Look at your httpd.conf (Apache configuration file) and look if the line that says 'LoadModule php5_module' isn't commented with # sign.

Also, look for 'Listen' should say 'Listen 80' so you can put simply http://localhost/ on the browser. If the server is running on another port instance e.g. the line shows 'Listen 8080', put on the browser http://localhost:8080/. This is a more uncommon issue.

If that doesn't make any change, maybe the PHP module isn't installed. I suggest to use a pre-configured package software with Apache/PHP/MySQL like xampp or mamp.

Make a new file on the root folder of your web server, 'test.php'. Add on the content:

<?php
echo phpinfo();
?>

Then on the browser access to http://localhost/test.php
It should display the PHP version and installed modules.

Well this is to manage sort of troubles with PHP, I haven't seen the previous page and the year :D

Member Avatar
BzzBee
Posting Whiz
327 posts since Apr 2009
Reputation Points: 5 [?]
Q&As Helped to Solve: 48 [?]
Skill Endorsements: 0 [?]
 
0
 

Install wamp or easy php, that will give you full package and easy to use.

Member Avatar
ayesha789
Posting Pro in Training
495 posts since Jun 2009
Reputation Points: 7 [?]
Q&As Helped to Solve: 7 [?]
Skill Endorsements: 5 [?]
 
0
 

You can also use XAMPP or PHPEASY
Both are easy
In Xampp Save your pages to Htdocs
for example your page is my.php and save in htdocs
then you have to write in browser
http://localhost/my.php
great
Maark this thread as solved.

Member Avatar
refrost
Newbie Poster
2 posts since Jul 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I have my index.php file in folder aldo on drive D. here is the detail
D:\PHP\www\aldo\index.php. what should i write on address browser to run this index, or should I need to create new folder ?? should I set the server (appserv) ??
Your assistance really much appreciated

Regards
Leonardo
<EMAIL SNIPPED>

Some background... (I use Apache on a Windows box) In the conf subdirectory of your Apache directory is a file named httd.conf and in that is your setting for Apache's "DocumentRoot". Mine is set to:

# -refa- Current doc root is on D: on win200pro 10/12/2006
DocumentRoot "d:/Apache/htdocs/refrost/www"

I create directories under this location, resulting in, say,

"d:/Apache/htdocs/refrost/www/webapp1"
"d:/Apache/htdocs/refrost/www/webapp2"

Then I put/create the index.php and other app files in the webapp1 or webapp2 directories and call them from the browser via:

http://127.0.0.1/webapp1/index.php

In your case, Leonardo, if you set your DocumentRoot to "D:/PHP/www" then you would call it via:

http://127.0.0.1/aldo/index.php

Clear as mud?

Ralph Frost

Member Avatar
shivanisaxean
Newbie Poster
1 post since Mar 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

what is localhost.php file & why it is used?

Member Avatar
Layerphp
Newbie Poster
17 posts since Nov 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi just place your file in the root directory i.e., if u have installed "xampp" then place your file in htdocs folder or if u have installed wampp then place your file in www folder.
like
C:/xampp/htdocs/newfolder/index.php
or
C:/wampp/www/newfolder/index.php
then to access that file enter this url in browser address bar
http://localhost/htdocs/newfolder
or
http://localhost/www/newfolder

i think this will help u...!

Member Avatar
Layerphp
Newbie Poster
17 posts since Nov 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

hey it's
http://localhost/newfolder
no need to enter root folder name

Member Avatar
dineshnbhatia
Newbie Poster
1 post since Oct 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Install Xampp will work then.
Go through this tutorial on Installing Xampp and Run PHP Codes on Windows

http://planetghost.com/run_php_code

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article