开发者

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:

http://maestric.com/doc/mac/apache_php_mysql_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


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

LoadModule php5_module libexec/apache2/libphp5.so

again.


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.


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

http://notfornoone.com/2010/07/install-php53-homebrew-snow-leopard/

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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜