Skip to content

Instantly share code, notes, and snippets.

@ruslanashaari
Forked from bgarrant/ValetSwitchPHP.md
Created May 12, 2018 12:12
Show Gist options
  • Save ruslanashaari/2dd1c2440302105eb30a69805842f873 to your computer and use it in GitHub Desktop.
Save ruslanashaari/2dd1c2440302105eb30a69805842f873 to your computer and use it in GitHub Desktop.
How to Switch PHP Version in Laravel Valet between PHP 7.1 and PHP 5.6

Valet switch PHP version with these commands

Install PHP 5.6 and switch Valet to PHP 5.6

valet stop
brew unlink php71
brew install php56
brew install php56-mcrypt
brew link php56
valet start

Then to switch back to PHP 7.1 it is as simple as:

valet stop
brew unlink php56
brew link php71
valet start

Then to switch to PHP 5.6:

valet stop
brew unlink php71
brew link php56
valet start
@ruslanashaari
Copy link
Author

For those who're using Ubuntu Valet (unofficial), after installing certain version of php, you just need to stop the valet before switching the php version.

valet stop

#choose your preffered php (you need to install php first)
update-alternatives --config php

valet start

For me, php7.2 already pre-installed in my Ubuntu 18.04. So I installed php5.6, php5.6-fpm and php5.6-cli before I can switch between my preferred php version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment