Laravel valet linked php error
Asked Answered
N

7

10

I got an error.

$ valet install

[DomainException]                
Unable to determine linked PHP.  

install

'which' command returns:

$ which php
/usr/local/Cellar/php70/7.0.6/bin/php
Nathanson answered 12/5, 2016 at 6:21 Comment(2)
Did you used "composer global require laravel/valet"Orthogenetic
Yes I did. Valet is working correctly as in it is showing the lists and version command.Nathanson
F
14

Homebrew creates (or attempts to create) symlinks in /usr/local/bin.

Start by running the following to attempt to create a link.

brew link php70

It'll give you information as to whether or not it was successful. Occasionally permissions are problematic and you can resolve this with

sudo chown -R `whoami`:admin /usr/local/bin

Then try running the brew link command again.

Alternately brew link may give you instructions, or you can use brew doctor to get a report on any problems which exist with your Homebrew installation.

When it's set up properly after running ls -la /usr/local/bin | grep bin/php$ you should see something similar to

lrwxr-xr-x 1 YOURUSER admin 29 10 May 21:40 php -> /usr/local/Cellar/php70/7.0.6/bin/php
Forefend answered 12/5, 2016 at 12:52 Comment(2)
I have the same error as the person over here, but these steps did not help me. I have tried to change php versions up and down without any result. No clue what to do?Balder
You can also try to run composer global update to update the version of Laravel used by Valet. In Valet 2.0.5 there is a change to the way PHP version detection works and it requires a > 5.2 version of Laravel.Wnw
D
20

if your PHP version 7.x and valet > 2.0.8 update valet valet stop

valet uninstall

brew install php

composer global require laravel/valet

then valet install

Distillate answered 25/5, 2018 at 12:53 Comment(1)
This is best answer. Worked flawlessly for me as well. Thank you!Minny
C
19

I used Homebrew to instal php7.1 , So I ran this command in terminal
ln -s /usr/local/opt/php71/bin/php /usr/local/bin/php
and everything is done.

Careycarfare answered 17/11, 2017 at 1:21 Comment(1)
I tried everything else and this was the only thing that fixed my installation. Thank you!Henotheism
F
14

Homebrew creates (or attempts to create) symlinks in /usr/local/bin.

Start by running the following to attempt to create a link.

brew link php70

It'll give you information as to whether or not it was successful. Occasionally permissions are problematic and you can resolve this with

sudo chown -R `whoami`:admin /usr/local/bin

Then try running the brew link command again.

Alternately brew link may give you instructions, or you can use brew doctor to get a report on any problems which exist with your Homebrew installation.

When it's set up properly after running ls -la /usr/local/bin | grep bin/php$ you should see something similar to

lrwxr-xr-x 1 YOURUSER admin 29 10 May 21:40 php -> /usr/local/Cellar/php70/7.0.6/bin/php
Forefend answered 12/5, 2016 at 12:52 Comment(2)
I have the same error as the person over here, but these steps did not help me. I have tried to change php versions up and down without any result. No clue what to do?Balder
You can also try to run composer global update to update the version of Laravel used by Valet. In Valet 2.0.5 there is a change to the way PHP version detection works and it requires a > 5.2 version of Laravel.Wnw
T
6

I was going to update Laravel Valet from version 1.* to 2 and ran same error like this

Unable to determine linked PHP

The solution was to run

composer global update

before I ran

valet install

Toastmaster answered 30/9, 2018 at 19:31 Comment(0)
R
2

This happens when your brew php gets Updated.

If you do brew install php this will work but will install php 7.2 by default.

If you want [email protected] you have to do brew install [email protected] this will install php7.1 and now when you restart valet valet restart you might get an error. Unable to determine linked PHP.

To make this work with php7.1 you have make brew link
brew link php71

you may have this error Warning: [email protected] is keg-only and must be linked with

to fix this brew link --force php71
now valet should work on php7.1

Refractory answered 18/5, 2018 at 0:40 Comment(0)
C
1

I tried all of the suggestions here—and several from elsewhere—before I hit on the solution. This applies to PHP 7.2 (no guarantee for other versions). If you are using the original Larvel Valet, open the file:

~/.composer/vendor/laravel/valet/cli/Valet/Brew.php

...or, if you're using Valet+

~/.composer/vendor/weprovide/valet-plus/cli/Valet/Brew.php

Locate the supportedPhpVersions method. In some versions, it will return an array right in the method:

return ['php72', 'php71', 'php70', 'php56'];

Change this to:

return ['7.2', 'php72', 'php71', 'php70', 'php56'];

In other cases, it'll reference const SUPPORTED_PHP_VERSIONS, and the change will be similar.

Save the file, restart valet, and Bob's your uncle!

Commentary answered 2/8, 2018 at 0:23 Comment(1)
Great, it solved the problem. but need to execute the command valet installSeptima
S
1

I've had the same problem tonight, and here's what I did to get it running:

brew unlink php && brew link php
brew services restart --all
composer global update
valet start

It would be nice if Valet had some suggestions on what to do when "Unable to determine linked PHP." comes up.

Sandy answered 2/4, 2023 at 8:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.