Skip to content

Instantly share code, notes, and snippets.

@willemvb
Last active June 29, 2018 09:21
Show Gist options
  • Select an option

  • Save willemvb/79431c19c4f53f12a882cf3c3511c852 to your computer and use it in GitHub Desktop.

Select an option

Save willemvb/79431c19c4f53f12a882cf3c3511c852 to your computer and use it in GitHub Desktop.
Switch PHP versions with Valet and Homebrew ^1.5

Install latest

Uninstall older formula

brew uninstall php
brew uninstall php70
brew uninstall php56

Install php versions with recent Homebrew ^1.5

brew install php
brew install [email protected]
brew install [email protected]

Switch aliases

php-from-56() {
    valet stop;
    brew services stop [email protected];
    brew unlink [email protected];
    brew link --force php;
    brew services start php;
    composer global update;
    valet start;
}
php-to-56() {
    valet stop;
    brew services stop php;
    brew unlink php;
    brew link --force [email protected];
    brew services start [email protected];
    composer global update;
    valet start;
}
php-from-71() {
    valet stop;
    brew services stop [email protected];
    brew unlink [email protected];
    brew link --force php;
    brew services start php;
    composer global update;
    valet start;
}
php-to-71() {
    valet stop;
    brew services stop php;
    brew unlink php;
    brew link --force [email protected];
    brew services start [email protected];
    composer global update;
    valet start;
}

Extensions

Mcrypt is included by default in new 5.6 formula

Others extensions example

pecl uninstall -r imagick
pecl install imagick
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment