3

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.

jsindos
  • 459
  • 6
  • 22
  • Did you try? brew unlink php56 – Jed Aug 03 '17 at 13:40
  • 1
    @Jed `$ brew unlink php56: Error: No such keg: /usr/local/Cellar/php56`. I believe for whatever reason my valet is using my macOS php... – jsindos Aug 03 '17 at 15:24
  • Huh, I ran into this once before. I gave up on brew and used the CURL method described here. https://medium.com/zenchef-tech-and-product/how-to-upgrade-your-version-of-php-to-7-0-on-macos-sierra-e1bfdea55a63 – Jed Aug 03 '17 at 15:33

3 Answers3

10

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
chimit
  • 548
  • 5
  • 20
0

Uncommenting LoadModule php5_module libexec/apache2/libphp5.so in /etc/apache2/httpd.conf did the trick. I don't really know why this worked, but I'm not complaining.

jsindos
  • 459
  • 6
  • 22
0

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/