开发者

Enable php on mac snow leopard [closed]

开发者 https://www.devze.com 2023-03-14 05:50 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 11 years ago.

Improve this question

Installed:

Entropy PHP 5.3.03.pkg

I have been trying to enable php on my mac. But everytime I point开发者_JAVA技巧 the browser to my test.php all I get is the source code being displayed:

I put my test.php in the following location:

user/admin/sites

And I browse to in using the following url:

http://localhost/~admin/test.php

and all I see is this:

<?php phpinfo(); ?>

I have done the following:

cp /etc/php.ini.default /etc/php.ini

chmod 666 /etc/php.ini

I have enabled web sharing in system preferences | web sharing

I have also uncommented the line in /etc/apache2/httpd.conf

#LoadModule php5_module libexec/apache2/libphp5.so

I have restarted apache

apachectl restart

However, I always end up with the source code being displayed.

Many thanks for any suggestions,


I can't answer your particular problem directly, but if you continue to have issues, may I suggest easy alternative? Install MAMP. Works like a charm with very little setup. Website here: http://www.mamp.info/en/index.html


You may need to load php module on apache

in /etc/apache2/httpd.conf , uncomment following line

LoadModule php5_module        libexec/apache2/libphp5.so

and then restart apache

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


Did you set up your apache root as users/admin/sites? You need to do that too, so apache knows where to look. Normally its somewhere like /var/www


You need to add AddType to your server config:

AddType x-httpd-php .php

This can be done in .htaccess or httpd.conf file. The AddType directive maps the given filename extensions onto the specified content type.

Also check for

include /private/etc/apache2/other/php5.conf in httpd.conf

0

精彩评论

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