This is the guide I followed to make PHP work on Snow Leopard:

Apache2 is working. http://localhost.lan works just fine. Virtualhost works too. Mysql is working.

PHP5 is not even with LoadModule php5_module libexec/apache2/

No correct solution


I think your apache2 install has a problem. You need to re-install apache2 then try

LoadModule php5_module libexec/apache2/


To clarify Neoryder's post, edit /etc/apache2/httpd.conf, find the line:

#LoadModule php5_module        libexec/apache2/

and remove the hash sign from the beginning to enable PHP in your web server. You have to go to your Sharing preference pane and uncheck and recheck Web sharing for the change to take effect.

I'll mention one more thing that caught me out moving from Linux to OS X...

Most people want to serve PHP files from their own Sites folders. There's lots of advice out there about configuring Apache using .htaccess files, and some of it won't work under OS X because Apache is locked down a bit by default.

For example, if you want to have PHP files ending with .html or .htm, most people will tell you to create an .htaccess file and put in it the line:

AddType application/x-httpd-php .html .htm

If you're a developer and this is annoying you, you may want to edit the file /etc/apache2/users/<myusername>.conf and change the line:

AllowOverride None


AllowOverride All

This will allow your local .htaccess files to override various global defaults that they couldn't before.

This is obviously a late answer...but I had the exact same problem and I used Homebrew to install a later version of php:

brew install php --with-apache --with-mysql

I then went into my httpd.conf file:

cd /etc/apache2
sudo nano httpd.conf

And changed the line:

#LoadModule php5_module        libexec/apache2/ --> the old version
# Below is the link to the new homebrew version
LoadModule php5_module /usr/local/Cellar/php/5.3.7/libexec/apache2/ 

(It depends where you install Homebrew, but the default is /usr/local)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow