Mac OS X Apache and PHP

There are programs around that make turning on Apache/PHP/MySQL very easy. But what if you want to use Mac OS X’s built in Personal Web Sharing.

  • Backup /private/etc/httpd/httpd.conf in case something goes wrong. Just duplicate it with a date-stamp or other memorable name.
  • Open /private/etc/httpd/httpd.conf with your favorite text editor.
  • Around line 240, uncomment the line that loads PHP module: LoadModule php4_module
  • Around 284, uncomment the link that adds the PHP module: AddModule mod_php4.c
  • Restart Apache by restarting System Preferences > Sharing > Services Tab > Personal Web Sharing.
  • Try a test document with phpinfo(). My version of Tiger had PHP Version 4.4.4 and the Configuration File (php.ini) Path at /etc.

phpinfo() running on localhost