Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apache Local Install not working

Status
Not open for further replies.

patricktr

Programmer
Feb 3, 2008
12
GB
I can someone help withb this stupid fundamental problem...

I am trying to install Apache2.2.8 (I have also tried 2.2.6 & XAMPP) but when I try the local test (http:/localhost/) it just times out. I have followed the instructions in O'Reilly's Learning PHP & MySQL to the letter (basically following the install wizard and using 'localhost' & localhost in the Network_Domain & Server_Name respectively and choosing HTTP server 2.0 programs for All Users.

I am running Windows XP Home SP2 (fully up to date).

Any help would be much appreciated.
Regards.
Patrick.
 
Try to disable the firewall for a bit. If it starts working, then you can recofigure your firewall to let it play nice.

 
Hi RhytymAce - thanks for the feedback but I had already tried doing that and it made no difference. Just to check I re-disabled my Firewall and disconnected from the Internet but still no good.

As an aside when I look at my Firewall monitor it tells me that Apache is running & that it is 'listening' but that the local & remote IP addresses are 0.0.0.0 (Port is HTTP & 0 respectively)? I thought setting the Network Domain & Server Name to 'localhost' should have set that to be 127.0.0.1:80 - no?

Any answers most welcome.
Regards.
Patrick.

 
When the browser and server are on the same machine, you access the server using This request will be on the loopback device 127.0.0.1 on port 80 as you say. By default, apache is configured to listen for all addresses on port 80. This means that you should also be able to access the server using the hostname (machine name) from anywhere on your network. When apache answers a request it looks for the ServerName directive. If it finds localhost or hostname it will serve the index page in the directory defined as DocumentRoot. On Windows it's usually something like "c:/path/to/htdocs".These two directives are a must. If you are hosting more that one site, then each vhost must have these two directives in them. By default if no match between the request and ServerName are found, the first ServerName found or vhost defined will be served. I would look at your httpd.conf file and make sure these directives are set. Any time you make changes to this file, you must restart apache.
 
Hi RA -thanks for the feedback but still struggling...

I have since upgraded to XP Pro, deinstalled and re-installed Apache having made sure nothing else is running and nothing is on port 80. I don't have IIS installed let alone running.

I have checked and tickled the httpd.conf file entries that have been pointed out to me ....

ServerRoot "C:/Program Files/Apache Software Foundation/Apache2.2"
Listen 127.0.0.1:80
ServerName localhost
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">

.... and I think they are ok, but still the problem persists.

It seems to be conflicting with IE (V7) in some way as I seem to be getting 'page not found' quite a lot after trying to find my local host but that might be coincidence.

The only other thing that I can see that looks curious is on the netstat log I get ...

TCP [httpd.exe] Local 127.0.0.1:80 Foreign 127.0.0.1:1058 (this port varies) Established
TCP [iexplorer] 127.0.0.1:1058 (port always matches previous entry) Foreign 127.0.0.1:80 Established

Nothing on Apache error log - last entry is "[Tue Feb 05 22:35:27 2008] [notice] Child 3188: Starting thread to listen on port 80.".

Please help (anyone) - sanity in jeopardy
 
The fact that more than one service is listening on the same ip should not be of any concern. I know the purists among us will say that 127.0.01 is not an ip address but the same holds true. You can take a web server, ftp server, mail server and any other server you want and bind them to the same address and there will be no problem. The port is where they get very territorial. Most Windows installs have two steps. One is to install the software then install it as a service. My next question was to make sure apache was running as a service but since you have logs, I guess it is which leads me to ask these questions: Is it still timing out? What is the error page showing in the browser when it times out? Are there any entries in your access log?
 
Hi RA, thanks for taking an interest.

Yes, it still does not work. There is no error message - just the 'egg timer' icon ... indefinetly.

There is nothing in the logs beyond what I referred to above.

AAAAhhhhhhhh!

Patrick.
 
What you attribute to the error log (I think) should actually be in the accesslog. Check those 2 directives
to make sure they point to 2 different paths.

Since the ports are Established, I believe you are talking to your webserver. And because you got Page not found instead of a different error leads me to believe it is misconfigured.

The easiest way to test (non browser) is to get on that server and use telnet to test:

run:cmd

telnet localhost 80
(if it doesn't connect at this point, then you aren't talking to anything)
get index.html (or some page you know is there)

For instance:

[root@superior ~]$ telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
get index.html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.2.3 (Red Hat) Server at superior.mydomain.com Port 80</address>
</body></html>

So this tells you the server is up but misconfigured (DocumentRoot wrong, in my case)

eugene



 
Hi Eugene, thank you for taking the time to respond.

You have hit on something here - telnet localhost 80 gives me ...

"Connencting to localhost ... Could not open connection to the host, on port 80: Connect failed"

ok .... but what does this mean - hodo I fix it?

Regards.
Patrick.
(starting to feel hopeful)
 
If this was on the local box, AND it you have it listening on port 80 (127.0.0.1) and you get this result, there has to be a firewall in play.

Besides the XP pro firewall, are you running another one?

eugene
 
I'm sorry Eugene - I was being stupid. I had uninstalled Apache last night last thing & forgot to reinistall. When I had reinstalled the telnet test respomded with a black 'dos' box?

I experiment with that bit of code you gave me and I'll get back to you.

Sorry to waste you time.
P.
 
Hi Eugene,

I'm trying to test this now but I need your help as I'm not sure what I'm doing.

When I type 'telnet localhost 80' I just get a black 'dos' box with nothing in it. When I try to type anything the cursor moves but I don't see any letters?

I have tried this with and without the firewall running and it is the same. I have now got the the firewall running but set it to recognise Apache but ask me first if I want it to connect - it does not ask?

Can you tell me how to progress this test please.

Regards.
Patrick.

 
It appears to connect (because it doesn't time out)
but with no output (try to type in "get filethatdoesnotexist")
to see if it will return a 404.

Lets see what is in both accesslog and errorlog.

I would run a generic httpd.conf (without php rewrite rules, etc.) I would suspect some type of loop or application error.

eugene
 
Hi Eugene,

I put get filethatdoesnotexist in at the c\ prompt and it said 'get' is not recognised as an internal or external command.

I tried to type it in blind in the black 'telnet localhost' box but that is just dead .. the cursor flashes but nothing happens and the typing is invisible.

I haven't done anything to the the conf file - I am running the file as it is after installation. I have still got to get php & mysql going (gulp) and then somehow move from a local environment onto the server (I'm really going off this project) - looking at the book this should've taken me minutes - I'm losing days .... is it always like this?

The Access log is empty. The error log is ....
Starting the Apache2.2 service
The Apache2.2 service is running.
rmine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[Wed Feb 06 20:25:13 2008] [notice] Apache/2.2.8 (Win32) configured -- resuming normal operations
[Wed Feb 06 20:25:13 2008] [notice] Server built: Jan 18 2008 00:37:19
[Wed Feb 06 20:25:13 2008] [notice] Parent: Created child process 2428
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[Wed Feb 06 20:25:13 2008] [notice] Child 2428: Child process is running
[Wed Feb 06 20:25:13 2008] [notice] Child 2428: Acquired the start mutex.
[Wed Feb 06 20:25:13 2008] [notice] Child 2428: Starting 64 worker threads.
[Wed Feb 06 20:25:13 2008] [notice] Child 2428: Starting thread to listen on port 80.

This time I disabled my wireless network connection but it didn't make any difference. When I do it connected to the network it tells me it sets the ServerName to the router IP address rather than 127.0.0.1 as above

Thanks again for your help with this - I am absolutley stuck. Programming in this environment is very new to me so I need all the help I can get.

Regards.
Patick.
 
I thought you were using "localhost" for ServerName?

That is disconcerting if it can't reverse localhost.

Try in a browser:
or from command prompt:
telnet 127.0.0.1 80
get nosuchfile.html

(I am not too hopeful on the results)

I know that XP has a patch for the 127 network problem, but what I read is that 127.0.0.1 is supposed to be unaffected.
eugene
 
I'm thinking along those line too Eugene. Patrick, if you don't get results from eugene's test, try another port. Have apache Listen to 127.0.0.1 on port 8080 or something and then try to telnet into that. If no joy, have apache listen for all addresses on port 80 (default). Then try to access it using the ip address assigned to eth0. If this box is getting its ip via dhcp from the router, you will need to assign it a static ip from outside the dhcp pool of addresses. The reason I'm suggesting all this is because nothing seems to be getting through on the loopback device. This will at least let you know if your server is configured correctly. If you don't want to have public access to this server, simply don't have port forwarding to it from the router. The fact that your box can't resolve localhost or even connect to lo directly using 127.0.0.1, tells me you have issues which go well beyond my realm of expertise.

 
OK guys, getting seriously dejected with this but it must be something under my nose ... everybody else in the world seems to be using this without problems so it works - we know that much at least - just not right here, right now.

I've disabled my wireless network card and pluged directly into the router. I've de-installed & re-installed again. (disabled the firewall) but this time I chose the 'localhost', 'localhost', install only for Current User on Port 8080 when started manually.

Now it doesn't start at all when I try to start it...

httpd.exe: Could not reliably determine the server's fully qualified domain name, using '999.999.999.999' (my router) for ServerName

<OS 10048> .... make_sock: could not bind to address 0.0.0.0:8080 no listening sockets available...

Checked netstat, nothing else on 8080?

Looked at conf file and servername was a comment;

was #ServerName localhost:8080 - changed it to
ServerName localhost:8080 ... saved and tried to restart again.

No ServerName error this time but still got the make_sock ..... D'oh!!!!

There has to be a simple answer to this.

P.
 
Are you using netstat or netstat -ao to verify a listening port?

BTW ServerName does not use the :port syntax. I don't know if this is fatal.

Check your hosts file to make sure localhost still exists,
C:\WINDOWS\system32\drivers\etc\hosts (text no extension)

If XP Pro is like XP, I believe that there is a registry setting MaxUserPort that defines the top end of user bindable ports. This is 5000. So joe schmo user can bind from 1025-MaxUserPort (there are some higher ones also). Well known ports are 1-1024.

So 8080 might not work. (unix isn't that restrictive)

If hosts is setup correctly, and ServerName is localhost and Listen is 127.0.0.1:80, you should not need to rely on your wireless or any network connection.

Lets also look at netstat -rn to make sure 127.0.0.1 is bound to the loopback interface.

eugene


 
Hi guys.

I gave up on Apache 2.2 and worked my way back until I ended up with a working version at 1.3..... hurrah we're up and running. Installed the latest version of php 5 and ..... see my "php 5 The requested method POST is not allowed" thread .... D'ooooohhhhhhh!

RA & Eugine, Once again thanks for taking time out to try and help ... it can get lonely out here.
P.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top