neutrofoton

Science, Technology and Life

Install PHP on OS X 10.8 Mountain Lion

| Comments

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
1
sudo vi /etc/apache2/httpd.conf

Uncommect (remove #) php module declaration

1
LoadModule php5_module libexec/apache2/libphp5.so
restart apache
1
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
1
<?php phpinfo(); ?>

Comments