Closed christophrumpel closed 7 years ago
What's it say when you run these commands?
which php
php -v
You might need to unlink PHP 5.6 and link PHP 7.0 or 7.1 using brew CLI,
brew unlink php56
brew link php70
I have the same issue. Valet uses previously installed v7.0.9. I already unlinked v7.0.9 and linked v7.1. which php
and php -v
displays the following info.
/usr/local/opt/php71/bin/php
PHP 7.1.0 (cli) (built: Dec 2 2016 11:32:42) ( NTS )
I did remove all old PHP versions on now it seems to work again. But I can't connect to MariaDB now, guess this is another problem.
Make sure you restart valet if you're switching php versions. FPM needs to be stopped then started again with the new PHP version.
Testing this locally I cannot replicate. On Fri, Dec 9, 2016 at 6:24 AM Christoph Rumpel notifications@github.com wrote:
I did remove all old PHP versions on now it seems to work again. But I can't connect to MariaDB now, guess this is another problem.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/laravel/valet/issues/237#issuecomment-266025233, or mute the thread https://github.com/notifications/unsubscribe-auth/AA9fOwZLsXZEinV9IFhzQPOulhGhtJTFks5rGWSmgaJpZM4LI35D .
I'm facing the same issue and I couldn't change it. I upgraded my php71 to php72 using brew, restarted valet, but it's still showing wrong version when I do phpinfo();
$ brew list | grep php
php72
php72-imagick
php72-opcache
php72-xdebug
phpunit
$ which php
/usr/local/bin/php
$ php -v
PHP 7.2.1 (cli) (built: Jan 5 2018 17:34:14) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.2.1, Copyright (c) 1999-2017, by Zend Technologies
with Xdebug v2.6.0beta1, Copyright (c) 2002-2017, by Derick Rethans
$ valet install
Stopping nginx...
Installing nginx configuration...
Installing nginx directory...
Updating PHP configuration...
Restarting php72...
Restarting dnsmasq...
Restarting nginx...
Valet installed successfully!
But phpinfo() still telling me it's running on PHP 7.1.8, with php.ini pulling from /usr/local/etc/php/7.1
.
Edit:
Apparently brew seems to have services php71 stuck in the memory. I did this and valet is now running 7.2 finally:
$ brew services stop php71
Stopping `php71`... (might take a while)
==> Successfully stopped `php71` (label: homebrew.mxcl.php71) //I thought I have uninstalled it?!
$ brew services start php72
==> Successfully started `php72` (label: homebrew.mxcl.php72)
$ valet start
Restarting php72...
Restarting nginx...
Valet services have been started.
And now my phpinfo() shows it as php 7.2.1
This was driving me bonkers. After upgrading from php71 to php72 using Homebrew I found there were compatibility issues with my app, and tried to uninstall php72 / reinstall php71. No matter what I did – reinstalling Nginx, Valet, PHP – the web server was stuck on php72.
Even though php72 had already been uninstalled, I needed to run brew services stop php72
to sort everything out.
Thanks @chaoszcat
@chaoszcat You, sir, are my hero.
This resolved my issues after the 3/31/2018 brew upgrade (move of php into homebrew core) and the ensuing issues. Thanks @chaoszcat!!!
Resolved my issue as well, thanks @chaoszcat!
Worked! thanks @chaoszcat
Jesus rollerblading christ thank you @chaoszcat !
For me brew didn't report having any services running, but doing a ps -ef | grep php
showed an old php71 service still running.
In fact, if I stopped the brew php service, Valet would still be working with php71.
To solve this I had to stop the process using launchctl unload <path to plist>
, where for me the path was /Library/LaunchDaemons/homebrew.mxcl.php71.plist
.
Then I run valet restart
and it grabbed the correct PHP version.
I hope that helps somebody and saves them half a day of hair pulling.
Sources: https://stitcher.io/blog/php-73-upgrade-mac https://superuser.com/questions/159486/how-to-kill-process-in-mac-os-x-and-not-have-it-restart-on-its-own
@mijewe That just worked for me PHP 7.2 -> 7.4. THANKS!
I'm having the same problem here.. Tried to do valet use 7.2
and although its using 7.2 in the console, when opening any site was using PHP 5.6.
I started to do brew services stop valet-php@5.6
.. then it started using php 7.3... did the same again (brew services stop valet-php@7.3
).. and then it got the right version.
@r-martins wrote:
I started to do
brew services stop valet-php@5.6
.. then it started using php 7.3... did the same again (brew services stop valet-php@7.3
).. and then it got the right version.
Something's odd here. Note:
valet-php@7.3
Where did the valet-
prefix come from?
The laravel/valet
package does NOT name the services with a valet-
prefix. Never has. It's always used Homebrew's default naming of php
, not valet-php
.
Evidently you're using some other unofficial spinoff of Valet eg You're certainly free to do that, but then you should also take your support questions to them.
Hi @drbyte . Thanks for the reply and for your concern about this. I started using mamp (which I used for several years), then I migrated to Valet (for 1 hour) and then I met valet+ where I am now. This is my current brew services list:
I guess it was pulled as a dependency from henkrehorst/homebrew-php, which is used by valet/valet+, as per brew info below:
Currently I'm using valet on a detached branch fa1205e. It was the latest version when I was installing and fighting against the acpu issue.
It worked! thanks @chaoszcat
Thanks @chaoszcat ... worked like a charm!
actually I tied every thing I can think about..... stop php, stop ngnix, restart valet... a few hours later, I decided to restart my computer. I can have a good sleep after sunrise.....
Can't thank you enough @chaoszcat . I lost too much time on it already and brew services stop php@7.4
finally worked!
Usually it works.
composer global update
Para mim resolveu somente desta forma
which php
rm -rf no caminho que aparecer
php -v
A mix of @chaoszcat and brew cleanup
did it for me.
Use brew services stop php@8.0.1
if you need to get PHP 8 out of the way after running valet use php@7.4
.
Run
valet use php@8.0 --force && sudo rm ~/.config/valet/valet.sock && valet restart && brew unlink php@7.2 && brew link --overwrite --force php@8.0 && sudo brew services restart --all && sudo rm ~/.config/valet/valet.sock && valet install && composer global update
Run
valet use php@8.0 --force && sudo rm ~/.config/valet/valet.sock && valet restart && brew unlink php@7.2 && brew link --overwrite --force php@8.0 && sudo brew services restart --all && sudo rm ~/.config/valet/valet.sock && valet install && composer global update
While that covers a lot of stuff, the latest Valet does most of it automatically nowadays.
valet use php@8.0 --force
did the trick for me.
Hey,
I just upgraded valet to version 2 and suddenly it is using a wrong version oh PHP. (5.6 instead of 7.0) I then installed PHP71 (with Homebrew) but Valet is still using PHP 5.6.
Any idea how I can fix that?