How to upgrade to php 7.4, 7.3, 7.2,... on MacOS?

How to upgrade to php 7.4, 7.3, 7.2,... on MacOS?
0

#1

In this share, I will quickly show you instruction to upgrade current php on MacOS Mojave, High Sierra, Sierra,… to newer versions: 7.4, 7.3, 7.2,…

How to check current php version on your MacOS?

  • Open Terminal (Found under /Application/others/)
    1543055040158-terminal
  • Enter the following command line:
php -v

Similarly, you will find:

  • php 7.1 on High Sierra
  • php 5.6 on Sierra
  • php 5.5.x on El Capitan

HOW TO UPGRADE PHP ON MAC?
Whatever your php version is, if you want to upgrade to newer version, ENTER one of the following command lines:

  • Upgrade to php 7.4
curl -s https://php-osx.liip.ch/install.sh | bash -s force 7.4
  • Upgrade to php 7.3
curl -s https://php-osx.liip.ch/install.sh | bash -s force 7.3
  • Upgrade to php 7.2
curl -s https://php-osx.liip.ch/install.sh | bash -s force 7.2
  • Upgrade to php 7.1
curl -s https://php-osx.liip.ch/install.sh | bash -s force 7.1
  • Upgrade to php 7.0
curl -s https://php-osx.liip.ch/install.sh | bash -s force 7.0
  • Someone may just ưant Upgrade to the latest of php 5.6
curl -s http://php-osx.liip.ch/install.sh | bash -s force 5.6

Apache Configuration

If you upgrade to 7.4, 7.3, 7.2, 7.1 or even the latest of 5.6, 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 .
Please leave a comment for your contributions.