Coolest Guides on the Planet

coolest guides on the planet

Coolest Guides On The Planet

Neil Gee

  • Home
  • macOS
  • WebDev
  • All Posts
  • Contact

Upgrade to PHP 7.3 or 7.2 on macOS Mojave, Sierra or on OSX 10.6 – 10.11

October 10, 2018 106 Comments

macOS Mojave ships with PHP 7.1, High Sierra 7.1,  Sierra ships with PHP 5.6, OSX 10.11 El Capitan with PHP 5.5.x, there is an easy upgrade method to either the latest PHP version 7.3 or 7.2  or you can also go back to the older stable version 5.6.

PHP versions 5.5 and older are now considered end of life, with 5.6 and version 7.1 these will be the end of life in December 2018.

With the new macOS Mojave & High Sierra they already come shipped with PHP7.1.

The latest PHP version in this guide is from this PHP Packaged site  which is being maintained for macOS and is known as a reliable source.

Download and Install PHP 7.3, 7.2, 7.1 or 7.0

Open Terminal and run…
or for 7.3

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.3

or for 7.2

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.2

or for 7.1

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.1

or for 7.0

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.0

You get a warning error for if the php is a newer version
The version is filed in /usr/local/php5 – Test the php version by creating a php file named phpinfo.php in your web root with the single function:

<?php phpinfo();?>

Browse to that file and see the version displayed.

php7-osx

 

If instead you just want to just update to the latest 5.6 PHP…

Open the Terminal and issue one command –

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6

 

That’s it! One line command in the terminal, this will download and install PHP5.6 in:

/usr/local/php5/

 

Apache Configuration

For either PHP version install 7.3, 7.2, 7.1 or 5.6 etc, the install script will also disable the previous PHP5.5 if it was enabled in the Apache configuration file /etc/apache2/httpd.conf . The new version is enabled in Apache right off the bat, the new install will comment out the older PHP module.

#LoadModule php5_module libexec/apache2/libphp5.so

It will load the new PHP version via the /etc/apache2/other/+php-osx.conf file.

So to reverse the behavior uncomment the older PHP module in httpd.conf and remove the new config in other.

Share this:

  • Twitter
  • Facebook

Related

Cats: macOS, Open Source, Tech

The Ultimate Managed Hosting Platform

Subscribe

Coolest Guides on the Planet

Tags

3gs 10.6 apache backup baseband Bing boot clean urls Coolest Guy on the Planet cpanel css custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect remote rsa SEO shell ssh terminal unstoppables urls Yahoo
Get DesktopServer

Donate a Beer to the Coolest Guides

Beaver Builder Ultimate Addons

Copyright © 2019· Neil Gee - All Rights Reserved - Hosted by Cloudways

Copyright © 2019 · gee on Genesis Framework · WordPress · Log in