PDA

View Full Version : apache httpd crashes endlessly




pakkman781
Jul 30, 2008, 04:05 PM
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.



theyellowdart
Jul 30, 2008, 07:14 PM
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.

pakkman781
Jul 31, 2008, 11:36 PM
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

Orngarth
Mar 5, 2009, 06:43 PM
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

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!

tray3
Mar 9, 2009, 11:26 PM
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?

Kludge420
Apr 29, 2009, 07:51 AM
first thing I would do, open up terminal (Applications->Utilities) and run the command

sudo mkdir /var/log/apache2


Thank you, fixed my constant crashing! That seems like some really poor coding but I've never been impressed with Apache.

jgcalifornia
Sep 2, 2009, 01:13 AM
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!!

relaydenied
Oct 4, 2013, 10:41 AM
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
/private/var/log

drwxrwxrwx 5 root wheel 170 Oct 3 14:01 apache2

HackPro:apache2 pault$ pwd
/private/var/log/apache2

-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 :)

tomsmeding
Apr 30, 2014, 08:47 AM
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!