Laravel valet linked php error

可紊 提交于 2019-12-01 14:30:40

问题


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

回答1:


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



回答2:


I'm used Homebrew to installed 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.




回答3:


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




回答4:


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 php@7.1 you have to do brew install php@7.1 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: php@7.1 is keg-only and must be linked with

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




回答5:


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!




回答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



来源:https://stackoverflow.com/questions/37178743/laravel-valet-linked-php-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!