PHP Monitor & PHP 8.2

December 09, 2022

PHP 8.2 was released on December 8th, and this is another great new language upgrade! As usual, I recommend that you upgrade as soon as possible to enjoy all of the new benefits.

This latest version of PHP is now available to install via the php formula with Homebrew, which means it’s easy to set up on your Mac now as well. I’ve ensured that PHP Monitor works with PHP 8.2, but there are some things you may want to pay attention to.

So, if you want to learn how to upgrade if you’re running PHP Monitor… Keep on reading, I’ve included a list of instructions you can follow here.

Upgrading to PHP 8.2

Before you start, you want to make sure to quit PHP Monitor. Additionally, to make sure Valet isn’t using a version of PHP we will be upgrading, also run the following:

valet stop

This stops Valet’s services and restores permissions on the Homebrew directories so they can be purged correctly when we upgrade our PHP installation(s).1

Okay, to get PHP 8.2, you can now run:

brew update && brew upgrade php

This will automatically upgrade your PHP installation to PHP 8.2.

You can verify that PHP has been upgraded by starting PHP Monitor again or running the following in your terminal:

php -v

In case this didn’t work and the version listed by php -v is incorrect, you may wish to uninstall all install PHP versions and reinstall the ones you want to keep, just to be safe:

brew uninstall [email protected]
brew uninstall [email protected]
brew uninstall php

Now you can install all desired PHP versions:

brew install php
brew install [email protected]

Installing older PHP versions

You may still want to use PHP 8.1 for some of your applications or websites. To get PHP 8.1 back, you will need to run:

brew install [email protected]

The same applies for PHP 8.0:

brew install [email protected]

Installing unsupported PHP versions

PHP 7.4 is now no longer officially supported.

If you wish to install older (backported) versions of PHP for local use, you can do so by using Shivam Mathur’s tap:

brew tap shivammathur/php

You may find that this tap is already in use: if you’ve used Valet before, it automatically uses this tap for legacy versions of PHP.

You can then install these older versions of PHP. These are supported by PHP Monitor and Valet 3:

brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]

One thing to note: always make sure to restart PHP Monitor after installing or upgrading PHP versions!

If you ran valet stop you will need to restart the nginx and dnsmasq services via PHP Monitor’s menu as well before your sites will be reachable once again.

Happy coding.

  1. Not doing this won’t break your Homebrew folder, but it will cause some older files & directories not to be removed or cleaned up (due to permission issues). If you didn’t, you may need to manually clean out these folders later… sadly. 

Tagged as: Announcements