PHP5 for Snow Leopard is not working even with the module enabled
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/libphp5.so
No correct solution
I think your apache2 install has a problem. You need to re-install apache2 then try
LoadModule php5_module libexec/apache2/libphp5.so
To clarify Neoryder's post, edit
/etc/apache2/httpd.conf, find the line:
#LoadModule php5_module libexec/apache2/libphp5.so
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
.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:
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/libphp5.so --> the old version # Below is the link to the new homebrew version LoadModule php5_module /usr/local/Cellar/php/5.3.7/libexec/apache2/libphp5.so
(It depends where you install Homebrew, but the default is /usr/local)