Valet: [DomainException] Unable to determine linked PHP.

Created on 2 Apr 2018  路  7Comments  路  Source: laravel/valet

There was a problem while using PHP71 despite all being fine valet could not detect it as valid version.
Then i noticed PHP71 is now [email protected] adding [email protected] to supported list solved my problem

Most helpful comment

FTR: Updating to Valet 2.0.12 did not solve the issue for me. Running this afterwards did the trick:

brew link --force --overwrite [email protected]

I don't know why it didn't take the first time. I ran composer global update, adjusted ~/.bashrc, ran source, opened new terminals. I'm guessing something in my migration from homebrew/php/php71 messed things up somewhere.

All 7 comments

same problem.

$ mkdir usr/local/Cellar/php
$ ln -s /usr/local/Cellar/[email protected]/7.1.16 /usr/local/Cellar/php/7.1.16
$ ln -s /usr/local/Cellar/php/7.1.16/bin/php /usr/local/bin/php
$ valet install

troublesome.
btw, how to swich php version [ lastest valet(2.0.8) with current brew]?

Related to #544

Hello guys,

I was having the same issue after knocking my head around i came upto this solution and its working perfectly .. Here you go 馃憤

so Firstly, i install Brew : /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then i installed php71 which is now [email protected] : brew install php71

-> after installation export : echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.bash_profile

-> brew link [email protected] --force --overwrite

->ln -s $(which php) /usr/local/bin/php

Then i installed composer using :

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

and mv composer.phar /usr/local/bin/composer

and then installed valet : composer global require laravel/valet

And then comes the tricky part :

-> open -e /Users/USERNAME-Directory/.composer/vendor/laravel/valet/cli/Valet/Brew.php

and alter

function supportedPhpVersions()
{
return collect(['php', 'php72', 'php71', 'php70', 'php56','[email protected]']);
}

-> open -e /Users/USERNAME-Directory/.composer/vendor/laravel/valet/cli/Valet/PhpFpm.php

and alter

function fpmConfigPath()
{
$confLookup = [
'php' => '/usr/local/etc/php/7.2/php-fpm.d/www.conf',
'php72' => '/usr/local/etc/php/7.2/php-fpm.d/www.conf',
'php71' => '/usr/local/etc/php/7.1/php-fpm.d/www.conf',
'php70' => '/usr/local/etc/php/7.0/php-fpm.d/www.conf',
'php56' => '/usr/local/etc/php/5.6/php-fpm.conf',
'[email protected]' => '/usr/local/etc/php/7.1/php-fpm.d/www.conf'
];

    return $confLookup[$this->brew->linkedPhp()];
}

and then final step : sudo brew services restart nginx && sudo brew services restart [email protected]

And DONE!!!!

Cheers!!

Or upgrade to valet 2.0.12 which already has the necessary code changes to support the April changes made to Homebrew's PHP numbering.
https://github.com/laravel/valet/releases

This issue should be closed.

please update Valet to the latest version:

composer global update

FTR: Updating to Valet 2.0.12 did not solve the issue for me. Running this afterwards did the trick:

brew link --force --overwrite [email protected]

I don't know why it didn't take the first time. I ran composer global update, adjusted ~/.bashrc, ran source, opened new terminals. I'm guessing something in my migration from homebrew/php/php71 messed things up somewhere.

My way to fix this was ti rewrite current php version: brew link [email protected] --force --overwrite
That worked for me in similar case. If you have questions in the whole process - ping me as well. Probably, I can help ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Flimm picture Flimm  路  5Comments

dannygsmith picture dannygsmith  路  5Comments

pmochine picture pmochine  路  5Comments

hsleewis picture hsleewis  路  5Comments

idmahbub picture idmahbub  路  3Comments