Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache Error on Mac OS X Lion

Tags:

macos

apache2

I keep getting this error on my apache install. I have php module enabled on it. Rest is the standard installation

[Thu Dec 08 06:46:42 2011] [error] [client 127.0.0.1] File does not exist: /usr/htdocs
[Thu Dec 08 06:46:42 2011] [error] [client 127.0.0.1] File does not exist: /usr/htdocs

Any ideas why does this happen and how to fix it.

Thanks

like image 872
Rishav Rastogi Avatar asked Dec 08 '11 01:12

Rishav Rastogi


2 Answers

Some problem with Mac OS X Web preferences. I had to go and enable Web Sharing from preferences to make it work,

System Preferences->Sharing->Web Sharing and restart Apache

I think its got something to do with apache user not having permission to access my DocumentRoot, which is not entirely obvious from the error_log.

like image 145
Rishav Rastogi Avatar answered Oct 21 '22 08:10

Rishav Rastogi


This error is caused by not having the proper httpd.conf settings.

The reason the error goes away if you turn web sharing on is that the appropriate configs are only loaded if web sharing is on due to some IfDefine tags that look like:

<IfDefine WEBSHARING_ON>
    ...
</IfDefine>

Thus, virtual hosts, and Library/WebServer/Documents as root etc only get activate if websharing is on.

For Lion a solution is to turn web sharing on.

For Mount Lion there is no web sharing, so that is not an option, and you have to remove the IfDefine tags, while keeping the content that is between them.

After changing your httpd.conf file you should always run:

apachectl configtest

This will let you know if you have syntax errors, module errors, etc.

like image 26
Peter Ajtai Avatar answered Oct 21 '22 07:10

Peter Ajtai