Laravel valet using wrong version of PHP

Viewed 3596

I'm running valet 2.0.5 and it is using the wrong version of PHP. When starting valet I get

$ valet start
Restarting php71...
Restarting nginx...
Valet services have been started.

But phpinfo() gives PHP Version 5.6.30 and Loaded Configuration File: /usr/local/etc/php/5.6/php.ini.

I've installed and relinked php using brew,

$ which php
/usr/local/opt/php71/bin/php

$ php -v
PHP 7.1.7

I've tried uninstalling and reinstalling valet, to no avail.

3 Answers

The old version of PHP (in my case 7.4) was "stuck" for some reason in Valet. Even though php -v returns me php 8.0. The way to force Valet to choose the right version you can use the following command:

valet use php@8.0 --force

Had a similar problem when upgrading from 7.1 to 7.2.

For me the solution was that I removed the symlinks for php7.1 from /usr/local/opt/

Related