Browser not connecting to localhost

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
maxheight
Forum Newbie
Posts: 5
Joined: Sat Mar 28, 2009 9:53 pm

Browser not connecting to localhost

Post 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?
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Browser not connecting to localhost

Post 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?
maxheight
Forum Newbie
Posts: 5
Joined: Sat Mar 28, 2009 9:53 pm

Re: Browser not connecting to localhost

Post 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.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Browser not connecting to localhost

Post 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.
maxheight
Forum Newbie
Posts: 5
Joined: Sat Mar 28, 2009 9:53 pm

Re: Browser not connecting to localhost

Post 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\
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Browser not connecting to localhost

Post 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.
maxheight
Forum Newbie
Posts: 5
Joined: Sat Mar 28, 2009 9:53 pm

Re: Browser not connecting to localhost

Post by maxheight »

This is what I have for DocumentRoot:
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"

Thanks for the help btw. :-)
maxheight
Forum Newbie
Posts: 5
Joined: Sat Mar 28, 2009 9:53 pm

Re: Browser not connecting to localhost

Post 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
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Browser not connecting to localhost

Post 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.
dead leprachorn
Forum Newbie
Posts: 6
Joined: Tue Mar 31, 2009 10:08 am

Re: Browser not connecting to localhost

Post 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).

Code: Select all

127.0.0.1     localhost
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:

Code: Select all

127.0.0.1:8888
Post Reply