⚠️ Switching to a PHP version lower van 7.1 with Valet 2.0 won’t work at the time of writing, as Valet 2.0 does not work with PHP < 7.1 until this issue is resolved.
ℹ️ UPDATE 2018.10.23: Freek has developed some handy aliases to easily switch PHP versions.
For some older projects that I still need to run, I recently started using Valet. As those projects sometimes require different versions of PHP – or when I want to test them with the latest PHP version – I followed this set of instructions by Michael Dyrynda:
With the most recent Homebrew – in which PHP got moved to the core – I had to slightly tweak the commands a bit though:
# Stop latest PHP (version 7.2) brew services stop php brew unlink php # Activate PHP 5.6 brew link email@example.com --force brew services start firstname.lastname@example.org
I noticed that after running these command you – somehow – might still have the “old”
php service running as
root (you can check with
brew services list). In that case force it to stop, and restart the new version service:
sudo brew services stop php brew services restart email@example.com
After these steps here I (finally) got it working.