Skip to content

Installing or upgrading to the latest version of PHP

Nico Verbruggen edited this page Nov 25, 2024 · 4 revisions

Installing or upgrading to the latest version of PHP

What happens when I upgrade PHP to the latest version?

PHP Monitor may be telling you that PHP 8.3 will be upgraded to PHP 8.4, when you press Upgrade All. This is because the underlying formula for php has changed.

If you choose to upgrade via PHP Monitor, this will happen:

  • phpmon keeps track of what PHP version is currently active, if it isn't PHP 8.3.
  • phpmon will upgrade PHP 8.3 to 8.4.
  • phpmon will also install PHP 8.3 again.
  • phpmon will then switch to the last active PHP version, which is most likely PHP 8.3.

This makes the upgrade process seamless for most users, without the usual disturbance of running brew upgrade and the php formula suddenly being a different PHP version!

If you do not want to retain the upgraded PHP version, you are free to remove it after using Upgrade All.

Why is a PHP version marked as unavailable?

It may be possible that for a short duration (usually over the span of a few days prior to or after a major PHP update) a particular formula is unavailable due to it being migrated away/aliased.

You can try running:

brew tap shivammathur/php

and restart PHP Monitor. It may just take a few days.

How it works

I try my best to ensure that the latest version of PHP is supported as quickly as possible.

To make this possible, PHP Monitor relies on:

Generally speaking, when a new release of PHP becomes stable, the homebrew-php tap is updated first, and Valet shortly after. There may be a short period of time when installing a PHP version does not work as expected, a few days prior and after the release of this new PHP version.

Upgrading the tap

Both of these need to be updated for the environment to work correctly. The Homebrew tap is updated automatically when you use the PHP Version Manager functionality.

To do this manually, run:

brew tap shivammathur/php

Upgrading Valet

Valet may need to be upgraded by running composer global require laravel/valet and running valet install afterwards. You should restart PHP Monitor after doing this.