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

Recommended Answers

All 18 Replies

umm do you have PHP installed and configured?

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

thanks a;; appreciate it

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.

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.

or if its linux then its usually /var/www

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>

localhost/aldo/index.php should suffice.

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

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

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.

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

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

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...!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.