I have the same problem!
brew list | grep php
brew unlink php7.1
brew link php7.2
sudo brew services restart php72
sudo brew services restart nginx
At least that worked for me.
So I temporarily fixed this by modifying valet. In $HOME/.composer/vendor/laravel/valet/cli/Valet/Brew.php I added [email protected] to the array in the function supportedPhpVersions(), like so:
function supportedPhpVersions()
{
return collect(['php', 'php72', 'php71', 'php70', 'php56', '[email protected]']);
}
Then I modified $HOME/.composer/vendor/laravel/valet/cli/Valet/PhpFpm.php, function fpmConfigPath(), like so:
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()];
}
Then I symlinked the new [email protected], $ ln -s $(which php) /usr/local/bin/php. I did a valet install after and this worked.
I know this is just a temporary workaround for me and I'll try to come up with a better solution. I hope this helps people get back to work today though.
Since php71 and [email protected] are identical in terms of paths and all that, maybe sanitizing the version with something like preg_replace('/php[@|\.]/', 'php', $this->brew->linkedPhp()); will fix this?
I'd recommend holding off on updating your php via brew. It just downgraded me from php 7.1.14 or so to 7.1.7 in this whole package rename process.
How to install imagick php 56
I submitted a pull request to address this issue. #549
Anybody having the issue with php 7.2 though? the fact its just now named php?
Adam addressed php version 7.2 (or above) being referenced as just "php" in commit 740d716cdd5ba7a55f8567f38b8d59185cd06e48
Only issue I've found is on test devices that are pinned to 7.2.
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!!
Expanding on the php-fpm modifications above, you'd also need to modify the taps and name of the default package installed for the install command to work when a brew version of php is not found.
The services list in the stop method should include the new service names as well.
I've added this to #564
The instructions above should include a valet install to ensure the configuration is written / updated, and the required services are installed.
@raveenasurani thank you so much, this solved the issue I was having
Since homebrew has stabilized, this can probably be closed.
Most helpful comment
So I temporarily fixed this by modifying valet. In
$HOME/.composer/vendor/laravel/valet/cli/Valet/Brew.phpI added[email protected]to the array in the functionsupportedPhpVersions(), like so:Then I modified
$HOME/.composer/vendor/laravel/valet/cli/Valet/PhpFpm.php, functionfpmConfigPath(), like so:Then I symlinked the new
[email protected],$ ln -s $(which php) /usr/local/bin/php. I did avalet installafter and this worked.I know this is just a temporary workaround for me and I'll try to come up with a better solution. I hope this helps people get back to work today though.