Page 1 of 1
Browser not connecting to localhost
Posted: Sat Mar 28, 2009 10:06 pm
by maxheight
I've installed and configured apache and php on my computer.
My browser doesn't pull up the test.php file in the htdocs folder.
I added the following to the httpd folder in apache:
AddType application/x-httpd-php .php
LoadModule php5_module "c:\php\php5apache2_2.dll"
SetEnv PHPRC C:\php\
and my php folder is on my c drive (c:php)
Any help?
Re: Browser not connecting to localhost
Posted: Sun Mar 29, 2009 2:08 pm
by califdon
Your Subject was "Browser not connecting to localhost" but all you have said is that a particular PHP script doesn't run. Those are 2 different issues. Does a simple index.html file work?
Re: Browser not connecting to localhost
Posted: Sun Mar 29, 2009 2:13 pm
by maxheight
No. I've tried several files and This is what I get:
Failed to Connect
Firefox can't establish a connection to the server at localhost.
Though the site seems valid, the browser was unable to establish a connection.
* Could the site be temporarily unavailable? Try again later.
* Are you unable to browse other sites? Check the computer's network connection.
* Is your computer or network protected by a firewall or proxy? Incorrect settings can interfere with Web browsing.
Re: Browser not connecting to localhost
Posted: Sun Mar 29, 2009 2:40 pm
by califdon
Usually this is the result of one of the following:
- Apache server isn't running (run msconfig and check Services).
- Apache is configured for DocumentRoot to be in a different place than you think it is (check httpd.conf).
None of this has anything to do with PHP.
Re: Browser not connecting to localhost
Posted: Sun Mar 29, 2009 2:51 pm
by maxheight
Apache is running
This is listed as the server root in the httpd.conf:
C:/Program Files/Apache Software Foundation/Apache2.2
This is what I added to the httpd.conf:
AddType application/x-httpd-php .php
LoadModule php5_module "c:\php\php5apache2_2.dll"
SetEnv PHPRC C:\php\
Re: Browser not connecting to localhost
Posted: Mon Mar 30, 2009 12:43 am
by califdon
maxheight wrote:Apache is running
This is listed as the server root in the httpd.conf:
C:/Program Files/Apache Software Foundation/Apache2.2
This is what I added to the httpd.conf:
AddType application/x-httpd-php .php
LoadModule php5_module "c:\php\php5apache2_2.dll"
SetEnv PHPRC C:\php\
Server root is different from DocumentRoot. Read the comments in your httpd.conf file. Mine says:
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "C:/Program Files/Apache Software Foundation/Apache2.2"
...
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/www"
As I told you before, this has nothing to do with any PHP files or settings.
Re: Browser not connecting to localhost
Posted: Mon Mar 30, 2009 12:27 pm
by maxheight
This is what I have for DocumentRoot:
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
Thanks for the help btw.

Re: Browser not connecting to localhost
Posted: Mon Mar 30, 2009 12:31 pm
by maxheight
Here's what the error log says:
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Re: Browser not connecting to localhost
Posted: Mon Mar 30, 2009 1:05 pm
by califdon
maxheight wrote:Here's what the error log says:
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
That sounds like it's a Windows issue, then, possibly with the
hosts file or something, and I'm afraid I'm not really "up" on those matters. Hopefully, someone else who recognizes this issue will see this and offer help.
Re: Browser not connecting to localhost
Posted: Tue Mar 31, 2009 4:00 pm
by dead leprachorn
it sounds like a port issue if apache/PHP are correctly configured.
Failed to Connect
Firefox can't establish a connection to the server at localhost.
Though the site seems valid, the browser was unable to establish a connection.
* Could the site be temporarily unavailable? Try again later.
* Are you unable to browse other sites? Check the computer's network connection.
* Is your computer or network protected by a firewall or proxy? Incorrect settings can interfere with Web browsing.
A loopback (HOSTS) issue would generate a 404 error generally. you could check the HOSTS file in c:\WINDOWS\system32\drivers\etc\hosts. look for the entry (near the top).
If it is there everything should work fine with regards to loopback issues. Make sure you are trying to access your server through an open port. try connecting to local host specifying different ports i.e: