tags:

views:

762

answers:

4

Mac OS X ships with apache pre-installed, but the files are in non-standard locations. This question is a place to collect information about where configuration files live, and how to tweak the apache installation to do things like serve php pages.

+5  A: 

Apache Config file is: /private/etc/apache2/httpd.conf

Default DocumentRoot is: /Library/Webserver/Documents/

To enable PHP, at around line 114 (maybe) in the /private/etc/apache2/httpd.conf file is the following line:

#LoadModule php5_module     libexec/apache2/libphp5.so

Remove the pound sign to uncomment the line so now it looks like this:

LoadModule php5_module     libexec/apache2/libphp5.so

Restart Apache: System Preferences -> Sharing -> Un-check "Web Sharing" and re-check it. OR

$ sudo apachectl restart
ctcherry
+1  A: 

httpd.conf is in /private/etc/apache2

Enable PHP by uncommenting line:

 LoadModule php5_module        libexec/apache2/libphp5.so
Larry OBrien
+4  A: 

Running

$ httpd -V

will show you lots of useful server information, including where the httpd.conf file can be found.

Patrick
+1  A: 

/etc/httpd/users contains user-specific configuration files which can be used to override the global configuration. For example, adding "AddHandler server-parsed html" to the <Directory> block in the /etc/httpd/users/*.conf file that corresponds to one user will enable mod_include parsing of HTML files for that particular user's $HOME/Sites directory, but nowhere else.

Michael Cramer