This Article Easily Show How to Install and Getting-Started with PHP5 by MacPorts on Mac OSX 10.5, 10.6 and 10.7.
The Post Include a Careful Explanation of the Article-Install Activation of MacPorts PHP5.
The Content give Focus Only to the Essentials Instructions and Commands to make it Easier to Follow.
-
Open a Terminal Window
(Press “Enter” to Execute Commands) -
Check if MacPorts are Installed:
which port
Installing the MacPorts:
MacPorts Installation Guide -
Install PHP5
sudo su
If Got “User is Not in Sudoers file” then see: How to Enable sudo
port install php5
-
Set the PHP Configuration File
cp /opt/local/etc/php5/php.ini-development php.ini
For production you Dispose of Template php.ini-production.
-
Activate the libphp5.so Module
cd /opt/local/apache2/modules
sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
-
Modify the httpd.conf File
nano /opt/local/apache2/conf/httpd.conf
Into the Block
Insert .AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps -
Restart Apache Server
/opt/local/apache2/bin/httpd -k restart
-
Make a Testing PHP Script
nano /opt/local/apache2/htdocs/test.php
Insert the phpinfo() Directive.
?>phpinfo();
?>
-
Test your PHP Installation
Load on Browser the PHP Testing Script.
http://localhost/test.php
You Should be Greeted by the PHP Info Sheet.