Once Apache web server is enabled, you can
start the below mentioned steps to enable PHP:
You need to be able to manipulate hidden
files for the next steps. In order to view hidden files follow the 10th
tip in my
earlier article with some basic tips on Mac usage.
Step 1: open the httpd.conf file in
HD/private/etc/apache2/httpd.conf.
Step 2: this file is root locked. So, you
need to change permissions to be able to edit it. (you could use the chmod command as a super user
or do it through the ‘get Info’ window
in the finder as shown:
Step
4: go to /private/etc folder and make a copy of the php.ini.default file
and name it as php.default. You could do
this through the finder window or the terminal
If you are using the terminal, use the
following commands:
Cd
/private/etc
Sudo
cp php.ini.default php.ini
Step 5: Restart the web server by going to
system preference -> sharing - >
Web Sharing (as
described in my previous article)
From the terminal if you want to restart
apache, here is the command:
sudo
apachectl restart.
Step 6: Now create a simple test file by
just tying
<?php
phpinfo() ?> and save it as ‘phpinfo.php’ file in your root web folder i.e. /Library/WebServer/Documents.
PHP is enabled on your machine !! Happy PHP coding :)