On the previous post, we have set up apache on OS X Mountain Lion. In this post we will continue to install php module to run with apache on Mountain Lion. PHP actually is shipped in OS X 10.8. The first step is edit httpd.conf
in apache directory.
# httpd configuration
sudo vi /etc/apache2/httpd.conf
Uncommect (remove #) php module declaration
LoadModule php5_module libexec/apache2/libphp5.so
# restart apache
sudo apachectl restart
To see and test PHP create a file with the content, and save in /Users/username/Sites as “test.php”. Then open in browser http://localhost/~username/test.php
// test.php
<?php phpinfo(); ?>