Mac OS X on x86 Hardware 2008–2024 Technical Archive
InfiniteMac OSx86 › Leopard 10.5 › Apache2 (WebSharing) Failed To Connect
3,578 reads · 2009-02-05

Apache2 (WebSharing) Failed To Connect

All of a sudden, my Apache 2 cannot be connected to. It is enabled in system preferences, and I've made no changes other than the necessary ones (enable PHP and change access port). I thought the problem was after installing Darwin…

Primary Author
@cmdshft Published 2009-02-05
Collection
Leopard 10.5
Archival Footprint
3,578 historical reads · 4 curated field notes (from 8 dispatches) · 2009-02-05
Credited Voices (2)
@cmdshft (4)@throttlemeister (4)

All of a sudden, my Apache 2 cannot be connected to. It is enabled in system preferences, and I've made no changes other than the necessary ones (enable PHP and change access port).

I thought the problem was after installing Darwin Streaming Server, so I uninstalled everything according to a guide I followed, but even now it's still not working.

I checked /etc/hostconfig, and it says WEBSERVER=-NO-, which is what it's supposed to be after having a friend test it on his system.

Any way to fix this or reinstall the websharing?

I mounted the DVD I used to install, and opened it up with Pacifist. I dug down to the apache2 part and installed that again. Rebooted, no joy.

This sucks, because I used my apache all the time for things. Everything else works though, FTP, SSH, everything.

Author Updates & Technical Revisions

Follow-up dispatches by @cmdshft

Author Update #1 @cmdshft 2009-02-05
[harataiki@Shadow-of-Intent ~]# ps -ef | grep apache
  501   531   517   0   0:00.00 ttys000    0:00.00 grep apache
[harataiki@Shadow-of-Intent ~]# netstat -a | grep 80
tcp4       0      0  192.168.1.112.49180    kc-in-f125.googl.jabbe ESTABLISHED
 56b1880 stream      0      0  6831cf0        0        0        0 /tmp/icssuis501
 5527908 stream      0      0  622d480        0        0        0 /tmp/launch-J5bXBX/Listeners
 5527880 stream      0      0        0        0        0        0
 4fcc880 stream      0      0        0  4fcc990        0        0
 4fcc990 stream      0      0        0  4fcc880        0        0
 5710880 dgram       0      0        0  5710908  5710908        0
 5710908 dgram       0      0        0  5710880  5710880        0
 56cf660 dgram       0      0        0  4fccdd0        0  56cf880
 56cf880 dgram       0      0        0  4fccdd0        0  5527990
2/5/09 1:53:47 AM com.apple.launchd[1] (org.apache.httpd) Throttling respawn: Will start in 10 seconds 
2/5/09 1:53:47 AM com.apple.launchd[1] (org.apache.httpd) Throttling respawn: Will start in 10 seconds 
2/5/09 1:53:57 AM org.apache.httpd[662] (2)No such file or directory: httpd: could not open error log file /private/var/log/apache2/error_log. 
2/5/09 1:53:57 AM org.apache.httpd[662] Unable to open logs 
2/5/09 1:53:57 AM com.apple.launchd[1] (org.apache.httpd[662]) Exited with exit code: 1 

Here is my httpd.conf file (in a text file): Download (hara.ip wn.me/other/files/other/mac/osx86/confs/httpd.txt)

Author Update #2 @cmdshft 2009-02-05

I don't see the dir:

[harataiki@Shadow-of-Intent ~]# ls  /private/var/log/
alf.log			install.log.1.bz2	system.log.0.bz2
asl			monthly.out		system.log.1.bz2
cups			secure.log		system.log.2.bz2
daily.out		secure.log.0.bz2	system.log.3.bz2
fsck_hfs.log		secure.log.1		system.log.4.bz2
ftp.log			secure.log.2.bz2	system.log.5.bz2
hdiejectd.log		secure.log.3.bz2	weekly.out
install.log		secure.log.4.bz2	windowserver.log
install.log.0.bz2	system.log		windowserver_last.log
[harataiki@Shadow-of-Intent ~]# ls  /private/var/log/apache2
ls: /private/var/log/apache2: No such file or directory

What should I do now? Do I just create the directory and make those two files then set the proper perms?

Author Update #3 @cmdshft 2009-02-05

Thank you, that got it working again.

Any reason it got borked, though? I don't mess with the logs so I don't know why how they were messed with.

Synthesized Community Field Notes

4 technical responses curated from 8 original dispatches

Field Note #1 @throttlemeister 2009-02-05

Is it actually running? (ps -ef|grep apache)

If so, is it listening to the port you expect? (netstat -a|grep http for default port 80)

What are the logs saying (typically located in /var/log/Apache/)? Any errors?

Field Note #2 @throttlemeister 2009-02-05

Your Apache is not running, so it is not surprising you cannot connect.

According to your logs, there is a problem with your logfiles and/or log directory.

Check if your log directory /private/var/log/apache2 excists, and if there is a error_log and access_log.

If there are, probably the permissions are incorrect. Most likely, the directory and/or logfiles are owned by root, and the Apache server is starting under user www. If the directory ownership is not www (ls -la to check), then do a "chown -R www:www /private/var/log/apache2" and try to start apache again.

HTH

Field Note #3 @throttlemeister 2009-02-05

Just do a mkdir /private/var/log/apache2 and chown -R www:www /private/var/log/apache2 and you should be set; Apache will create its logfiles when it starts up.

Field Note #4 @throttlemeister 2009-02-05

I have no idea. Computers are weird sometimes. Maybe you had a crash at some point, and the disk check upon next boot removed it.

Glad to have been of help. As a former unix admin, this stuff is a lot easier for me than getting my WiFi running under OSX.

Sources & Contributor Provenance (2 credited usernames · Thread #2067)
UsernameDossier ContributionDispatchesActive Window
@cmdshftPrimary Author42009-02-05
@throttlemeisterCore Contributor42009-02-05