On my machine I see two results the first result is for the latest PHP v7.3 and the other is obviously PHP v7.2: You can show all installed versions of PHP by running: Run the following command to see the symlink created that points to the installed PHP CLI binary: Run the following to only list the installed PHP extensions: Run the following to see all information and configuration settings for the installed version: You can run the following command to verify the current PHP version.
#PHP FOR MAC SIERRA INSTALL#
Now install the latest PHP version using the command:Īfter running this command latest version of PHP (7.3 as of this time) will be installed.
You can safely ignore any file or directory does not exist errors. Note: some of the commands above may not be required, but running them all will ensure a clean uninstall. The first line in the above bash statements goes through all installed versions and removes them all. Rm ~/Library/LaunchAgents/ * sudo rm /Library/LaunchDaemons/ * The following is the bash commands I use to clean out my PHP installation directories:īrew list | grep php | xargs brew uninstall -force rm -rf /usr/local/lib/php To do a fresh install, we first need to remove any existing brew PHP installations. Removing all brew installed versions of PHP So for instance if you have the latest PHP version 7.3 installed and you also have PHP version 7.2 installed, you can run brew upgrate php to upgrade the PHP version 7.3 and run brew upgrade to upgrade the older version 7.2. If you have multiple PHP versions installed by brew, you can upgrade the older versions with the latest patches by running brew upgrate installing older versions of software, brew uses the version number to name the installation directories so we have to use the version number in the command to tell brew which version we want to upgrade. Upgrading a specific PHP version Homebrew installation Note: Even if you are on the latest minor release of PHP, running brew upgrade php will ensure that all the latest patches are applied. Note: We did not specify the php version to upgrade which defaults to upgrade the latest installed version on our machine. If you already have a PHP version installed by brew, you can run brew upgrade php to upgrade the latest version of PHP installed on your machine to the latest released version of PHP. Upgrading to the latest PHP Homebrew installation Run brew doctor afterwards to make sure brew does not see any issues with current installed packages. Note: Be careful to not run brew upgrade instead, which updates all the packages that brew has installed on your system.
#PHP FOR MAC SIERRA UPDATE#
If you already have brew installed, make sure to update it before installing PHP by running: This bash script downloads and runs a Ruby language script using the default Ruby installation on your Mac.