PHP (= Hypertext Preprocessor) is an HTML-embedded server-side scripting language.

PHP is distributed at no charge for commercial or non-commercial use. For more information read the LICENSE information.

More information about PHP can be found at:

PHP manuals can be found at:

The latest PHP version can be downloaded from:

Installing PHP5.6.30 on macOS Sierra.

This tutorial describes how to install a different PHP version on the macOS Sierra.
The preinstalled system PHP version remains intact and will not be removed.

The binary php 5.6 package is downloaded from

A reason why you might want to install this binary package is that more php extensions, such as FreeType, are installed. The preinstalled system PHP version is missing several php extensions.

Operating system used
macOS Sierra

Software prerequisites

  1. Download and install PHP 5.6:
    curl -s | bash -s 5.6

    You will see the following:

    extracted to /usr/local
    Extracting usr/local/php5-5.6.30-20170506-093822/bin/tiffmedian
    Extracting usr/local/php5-5.6.30-20170506-093822/bin/tiffset
    Extracting usr/local/php5-5.6.30-20170506-093822/bin/tiffsplit
    Extracting usr/local/php5-5.6.30-20170506-093822/bin/tsql
    Extracting usr/local/php5-5.6.30-20170506-093822/bin/uconv
    Extracting usr/local/php5-5.6.30-20170506-093822/bin/vacuumdb
    Extracting usr/local/php5-5.6.30-20170506-093822/bin/wrjpgcom
    Extracting usr/local/php5-5.6.30-20170506-093822/bin/xgettext
    Extracting usr/local/php5-5.6.30-20170506-093822/bin/xslt-config
    Extracting usr/local/php5-5.6.30-20170506-093822/bin/xsltproc
    Executing post-install script /tmp/5.6-10.10-frontenddev-post-install
    Create symlink /usr/local/php5/entropy-php.conf
    Restarting Apache
    [Sat Jun 03 16:26:55.532811 2017] [so:warn] [pid 27019] AH01574:
    module php5_module is already loaded, skipping
    Syntax OK

  2. Edit .bash_profile and add the following line:
    export PATH=/usr/local/php5/bin:$PATH

  3. Edit /etc/apache2/httpd.conf and add the following line:
    #LoadModule php5_module libexec/apache2/
    LoadModule php5_module /usr/local/php5/

  4. The ini file is executed in the following order:
    • First /usr/local/php5/lib/php.ini is executed (Note: /etc/php.ini is not used)
    • Second /usr/local/php5/php.d/99-liip-developer.ini is executed.
      The settings in 99-liip-developer.ini overrules the settings in php.ini.

    To know where you php.ini is located, type: php --ini

  5. Modify /usr/local/php5/php.d/99-liip-developer.ini
    display_errors = Off
    display_startup_errors = Off

  6. Restart apache
    sudo apachectl restart

  7. To test the PHP installation, create a file phpinfo.php with the following line:

    <?php phpinfo(); ?>

    Save this file into your docroot and access this file in a browser.

    You should see something like this: