Construction worker, working on a log of wood on a construction site.

Install legacy PHP versions via Homebrew

local-setup Dec 12, 2022

Even if PHP 8.2 was just released, sometimes you still have to use old versions to do maintenance on older applications.

If you now try to install for example PHP 7.4, it will fail. Homebrew removes old versions that are not supported anymore.

Error: php@7.4 has been disabled because it is a versioned formula

Good idea — but a problem for us, as we still need to work on our PHP 7.4 application.

Luckily there is another way to get older version up and running, by using the tap by Shivam Mathur:

brew tap shivammathur/php

Now you can just install legacy PHP versions by using:

brew install shivammathur/php/php@7.4

Photo credit: Jeriden Villegas