0

I have multiple versions of PHP running under Homebrew. I need 8.0 to be the active one.

When I check the command line using php -v I see PHP 8.0 but when I try to load any web page I get PHP 7.4.

brew services list

All versions of PHP are showing an error, as you can see.

I've tried completely uninstalling and reinstalling all PHP services but still having this issue.

brew services stop php@7.4 does not fix the issue either. It seems like it is stuck in memory somehow since I installed PHP 8.0.

How do I get just one version of PHP to run at a time with this scenario?

eComEvo
  • 11,669
  • 26
  • 89
  • 145
  • I think you can accomplish with `brew link` command. – Daan Mar 03 '21 at 08:33
  • Unfortunately that didn't work and none of the solutions given on the ticket by the admin that closed this ticket worked. All of my php instances are already linked. – eComEvo Mar 04 '21 at 01:03
  • `All of my php instances are already linked` - only 1 should be. That's the point of linking, to specify which version should be used. See eg https://stackoverflow.com/a/59150210/6089612 The php you are running when you do `php -v` on the command line is different to the one your web server (Apache maybe) uses though, so you'll also need to check the PHP configured for Apache, as described in the linked duplicate. – Don't Panic Mar 04 '21 at 07:59
  • I'm using nginx and I mean they are linked when they are made active. I use `valet use php@7.4` (for example) and it does the linking automatically. This stopped working after PHP 8.0 was installed. Now one of them gets stuck as the active service after I switch even if I run `valet use` again with a different version. I have to stop and uninstall all versions of PHP then restart my Mac, then reinstall the version desired, just to actually serve the web pages in the version I want. If I only have PHP 7.2 and 7.4 installed, the problem doesn't happen and I can happily switch between them. – eComEvo Mar 04 '21 at 20:01

0 Answers0