apache httpd crashes endlessly

Discussion in 'Mac OS X Server, Xserve, and Networking' started by pakkman781, Jul 30, 2008.

  1. pakkman781 macrumors newbie

    Jul 10, 2008
    Lebanon, TN
    Well, I was about to start experiementing with WordPress on my MacBook Pro, using web sharing. So I go turn on Web Sharing in System Prefs, and goto localhost. Hmm, failed to connect, but I just turned on web sharing! So I look at console, and it looks like httpd has gotten itself into an endless crashing loop.

    7/30/08 4:02:33 PM com.apple.launchd[1] (org.apache.httpd[13149]) Exited with exit code: 1 
    7/30/08 4:02:33 PM com.apple.launchd[1] (org.apache.httpd) Throttling respawn: Will start in 10 seconds 
    7/30/08 4:02:43 PM org.apache.httpd[13150] (2)No such file or directory: httpd: could not open error log file /private/var/log/apache2/error_log. 
    7/30/08 4:02:43 PM org.apache.httpd[13150] Unable to open logs 
    There's about a million of these in the logs. I have no idea why this is happening. I'm not terriblly well versed on the inner workings of apache and httpd, so I don't know what to look for. Is there anyway to reset these to default and start over?

    The only odd things I have done is 1. installed, then uninstalled freenet 2. restored from a Time Machine backup.
  2. theyellowdart macrumors regular

    Jul 29, 2008
    The Mitten State
    first thing I would do, open up terminal (Applications->Utilities) and run the command

    sudo mkdir /var/log/apache2
    All that will do is create the folder that it's trying to write the error log too (it will prompt for a password too, I promise i'm not telling you to do anything nasty :D You'd trust a random guy on the internet right? ;) )

    That folder may already be created, and the problem is you don't have permission to write to that folder. If that's the case you will get an error when you run the command saying the file already exists, just change permissions on the folder by running this:

    sudo chmod 777 /var/log/apache2
    What this will do is give all the users on your system permission to read and write files in that folder. Since it could be a permission issue as to why it can't create the error log.

    After all that, restart apache, it will probably crash, but you should be able to go to /var/log/apache2 (command + shift + G on finder to /var/log/apache2) and look at the error log it's creating.
  3. pakkman781 thread starter macrumors newbie

    Jul 10, 2008
    Lebanon, TN
    You sir, are my hero! It turns out that the reason apache was crashing in the first place was because the directory didn't exist! Now it's working fine. How strange.

    I'm well versed enough in the CLI to know what mkdir and chmod do, I just never would've thought that would be a problem XD

    Thanks a million :D
  4. Orngarth macrumors newbie

    Jan 8, 2008
    Problems with web sharing

    I was having the same problem. The wiki (MediaWiki) I had installed on my computer stopped working. I couldn't access any of the pages, and clicking on the "Your computer's website" link in the sharing pane also didn't work. Looking at my console it had 4000 messages in the past 12 hours, almost all of them the following 3 repeating over and over:

    3/5/09 4:14:49 PM org.apache.httpd[78756] (2)No such file or directory: httpd: could not open error log file /private/var/log/apache2/error_log.
    3/5/09 4:14:49 PM org.apache.httpd[78756] Unable to open logs
    3/5/09 4:14:49 PM com.apple.launchd[1] (org.apache.httpd[78756]) Exited with exit code: 1

    Adding the directory it was looking for stopped the error messages and now both "my computer's website" and my MediaWiki homepage work! Hooray for Mac forums!
  5. tray3 macrumors member

    Dec 16, 2007
    me too had the exact same problem, thanks to theyellowdart its working now :)

    However i am still seeing this msg in my console

    3/9/09 9:24:17 PM com.apple.launchd[1] (org.apache.httpd) Unknown key: SHAuthorizationRight

    and i checked that i don't have the "/etc/httpd/httpd.conf" file.

    Any suggestions?
  6. Kludge420 macrumors regular

    Apr 20, 2009
    Thank you, fixed my constant crashing! That seems like some really poor coding but I've never been impressed with Apache.
  7. jgcalifornia macrumors newbie

    Apr 29, 2009
    re: apache httpd crashes endlessly

    hey, i noticed you guys got some great results here, and was wondering if you could shed some light here??? This afternoon, i had installed a canon printer driver update. Had firefox open, 2 finder windows, and my entourage. i went to search for something in my users/library folder, come to find this folder is empty!! total panic, opened time machine to make sure this folder was full, hopefully from last backup, and all of a sudden, time machine closes itself, takes me to my desktop, and all of my settings are gone...like smoke! Wallpaper became the default Leopard, my icons were enormous, and the dock was default. I did a restart, loaded same way, but weirdly enough, my folders were still on my desktop..itunes and iphoto empty. Wound up doing a restore from backup, but trying to figure out how and why this happened.My console seems to be going nuts with multiple messages, and would love to hear any input.. Took c couple screenshots.

    thanks in advance for your input!!

    Attached Files:

  8. relaydenied macrumors newbie

    Jun 1, 2008
    Directory and files exist

    All searches seem to relate this error to the error log files and permissions. Mine exist and have proper permissions. In fact, if you erase the log files and start Apache it creates the files. However the error persists and the pages are not available.

    system log:

    Oct 4 09:17:30 HackPro com.apple.launchd[1] (org.apache.httpd[21361]): Exited with code: 1
    Oct 4 09:17:30 HackPro com.apple.launchd[1] (org.apache.httpd): Throttling respawn: Will start in 10 seconds

    /private/var/apache2 error log:

    Unable to open logs

    file permissions:

    HackPro:log pault$ pwd

    drwxrwxrwx 5 root wheel 170 Oct 3 14:01 apache2

    HackPro:apache2 pault$ pwd

    -rwxrwxrwx 1 root wheel 0 Oct 3 14:01 access_log
    -rwxrwxrwx 1 root wheel 137040 Oct 4 09:08 error_log

    Interesting though. I have to set the file permission on the log files. Apache creates them as such:

    drwxrwxrwx 4 root wheel 136 Oct 4 09:37 .
    drwxr-xr-x 71 root wheel 2414 Oct 4 09:36 ..
    -rw-r--r-- 1 root wheel 0 Oct 4 09:37 access_log
    -rw-r--r-- 1 root wheel 20 Oct 4 09:37 error_log

    Thank you for help ahead of time :)
  9. tomsmeding macrumors newbie

    Mar 7, 2014
    Launchd solution

    You might want to do:

    sudo launchd remove org.apache.httpd
    It worked for me... Just for anyone looking at this thread and seeing no working solution!

Share This Page