in Mac, PHP

Location of hosts httpd.conf php.ini on Mac OSX

I’m sick of forgetting where to find my local development files so here is a quick breakdown. It includes hosts file, httpd.conf and php.ini

hosts

The hosts file is used to point domains at an i.p although in most cases it will just be a list of 127.0.0.1 and a domain name such as mysite.local or mysite.hjb in my case.
For < 10.5 you used to use netinfo manager to add extra domains and didn't really use the host file, although in 10.5 (and probably later) you do use the host file. locations:

/private/etc/

httpd.conf

The main apache config file. This is where all the setting for apache are stored. After making changed you need to restart web sharing in system preferences sharing for them to have an effect.

locations:

/private/etc/httpd/

php.ini

The main php config file. This is where all the setting for php are stored. After making changed you need to restart web sharing in system preferences sharing for them to have an effect.

locations:

/usr/local/php[4|5]/lib/

Sites folder

This is where your actual site files are stored and depends on if you are using the default osx install or a 3rd party install. I strongly suggest Marc Liyanage‘s help here as it deals with plenty of plugins too including the always useful gd2 image library.

locations:

/Users/[username]/Sites/
/Library/Webserver/Documents/

  1. The tilde “~” is a shell shortcut to the home directory.

    For the paths above to be valid, you must remove the tilde prefix.

  2. The info about php.ini’s location pertains to a manual install of PHP, in /usr/local, as opposed to OS X’ standard location, right?

    If I’m not mistaken, OS X’ preinstalled PHP uses this location:

    /private/etc/

Comments are closed.