views:

268

answers:

2

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

http://maestric.com/doc/mac/apache_php_mysql_snow_leopard

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

PHP5 is not even with LoadModule php5_module libexec/apache2/libphp5.so

Please advice. Do I need to start over? I hope not.

+2  A: 

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

LoadModule php5_module libexec/apache2/libphp5.so

again.

Neoryder
+1  A: 

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 .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

to:

AllowOverride All

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

Dave G
I actually knew about AllowOverride All. But the issue was a broken setup of apache2. What worked for me:These are the guides I followed which worked very well.http://diymacserver.com/installing-apache/compiling-apache-in-64-bits-mode-on-leopard/http://diymacserver.com/installing-php/http://diymacserver.com/installing-apache/starting-apache-at-boot-on-leopardI also removed the default apache2 which comes with Leopard.sudo rm -rf /etc/apache2Install fink before installing PHP5.
kgpdeveloper