MacOS – Upgrade PHP, not install additional PHP

macosPHPupgrade

My new work has just given me a MacBook Pro running macOS Sierra 10.12.6 to use as a development machine. It has PHP 5.6 installed and when I ran curl -s http://php-osx.liip.ch/install.sh | bash -s 7.1 (as recommended by many online guides), it installed PHP 7.1 in a separate directory while leaving PHP 5.6 intact.

I have a few issues:

  • PHP 7.1 will not run by default
  • The Non Thread Safe version was installed
  • When I run PHP 7.1 directly, it takes 5 seconds to start (I timed it), while PHP 5.6 starts instantly

One site recommended adding the new PHP directory to the start of the PATH environment variable, but that seems like a band-aid solution.

How can I update the existing PHP 5.6 version to PHP 7.1 (Thread Safe), and have it respond instantly when run?

Best Answer

I know you don't want to install a different PHP, but I've found using the Homebrew install method quite painless and robust. Maybe give it a try.

brew install php