Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

chubbard216's avatar

How to fix 'Unable to determine linked PHP' in Valet after PHP Upgrade

I upgraded my version on PHP using homebrew to 7.3, and all my sites became 502 Bad Gateway.

I downgraded PHP back to 7.2 and now when I run valet restart I get the following output:

In Brew.php line 182:
  Unable to determine linked PHP.

I tried running valet use [email protected], but that results in Command "use" is not defined..

** Update **

I ran brew services list and here is the output (below). I'm not sure how it is that when I run brew services start php the output is Service php already started, use brew services restart php to restart. but when I run brew services restart php the output is Error: Formula php is not installed.

Chriss-MacBook-Pro-2:~ chris$ brew services list;
Name    Status  User  Plist
dnsmasq started root  /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
httpd   stopped
mysql   started chris /Users/chris/Library/LaunchAgents/homebrew.mxcl.mysql.plist
nginx   started root  /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
[email protected] stopped
Chriss-MacBook-Pro-2:~ chris$ brew services start php
Service `php` already started, use `brew services restart php` to restart.
Chriss-MacBook-Pro-2:~ chris$ brew services restart  php
Stopping `php`... (might take a while)
==> Successfully stopped `php` (label: homebrew.mxcl.php)
Error: Formula `php` is not installed.

I do have the following in my .bash_profile

export PATH="/usr/local/opt/[email protected]/bin:$PATH"

export PATH="/usr/local/opt/[email protected]/sbin:$PATH"

0 likes
3 replies
chubbard216's avatar

Ok so running brew services start [email protected] did the trick. I was previously running brew services start php. Is there any way I can get that service to start automatically?

Please or to participate in this conversation.