In this chapter we are going to explain how to install PHP on a Mac platform.

PHP may be installed on Mac in two different ways, a package installation and a bundle installation. To install it as a package, we may use one of these sources:

Other sources may be available as well.

The standard installation include a module PHP which is configured on the Apache server. The steps are as follows:

  • Locate httpd.conf file and open in a text editor.
  • Uncomment the lines shown here:
    • #          LoadModule php5_module libexec/httpd/
    • #          AddModule mod_php5.c
  • Remember or write down the path when building the PHP file.
  • Location of the php.ini file should be “/usr/local/php/php.ini“.
  • Locate the root directory path “/Library/WebServer/Documents”.
  • Restart the web server.


›› go to examples ››