Homebrew PHP – Where Does Homebrew Install Legacy PHP Versions?

homebrewPHP

In order to make some old software work, I need to downgrade my PHP version from 8 to 7.4. I run this command without any problems:

brew install php@7.4

… and homebrew buzzes and whirs and dutifully installs php 7.4.

Now the problem is that I have no idea where the binary for php 7.4 lives.

I tried ls -al /usr/local/bin/ | grep "7.4", but that didn't come up with any results.

When I do php -v, I still get version 8 showing up.

Where can I find the version-specific legacy binary for php 7.4?

Best Answer

Since PHP 8 is already installed, Homebrew won't link an earlier version of PHP to php.

  1. Try brew link php@7.4
  2. Otherwise access the Cellar directly: /usr/local/Cellar/php@7.4/*/bin/php