The OS X users out there are no doubt familiar with the Homebrew package management system that makes it easier to install and update software on your system. This includes PHP and several other related pieces of software. In this post to his site Andy Grunwald shows you how to use Homebrew to migrate your local PHP setup up to PHP 7.2.
Last week, Hans Puac, a colleague of mine, wrote a small guide into our internal company chat on how to migrate your local PHP environment on macOS to the new Homebrew version 1.5.*. The guide helped a lot of other engineers inside trivago. I thought it might help more people from the internet. I asked Hans if I am allowed to share it, and he approved. So kudos belongs to him. Here we go:
With Homebrew 1.5.0 the tap homebrew/php got deprecated. They migrated it to homebrew/core, but this is changing the installation process completely.
He then walks through the steps (complete with the commands required) to make the update happen:
- Cleanup (the currently installed PHP packages)
- Update [Homebrew]
- Install PHP (7.2)
- Verify the installation
- Install extensions
He also includes a few tips to help you troubleshoot some of the common problems including wrong versions of PHP, wrong
php.ini being used and a "module already loaded" issue.