Forked from AllieRays/switching PHP and Drush versions for Drupal 7 and Drupal 9
Created
March 7, 2023 18:29
-
-
Save briantully/6468310561e8fdd4f56d128df3d7bc18 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Switch between PHP 7.4 and 8.0 and Drush Version 8 and 11 | |
# To use this script download this file and name it switch-php.sh | |
# and give it the correct permissions | |
# You can then run ./switch-php | |
# with the argument 7.4 or just ./switch-php | |
# For example ./switch-php 7.4 | |
## First need to download PHP Versions | |
## brew tap shivammathur/php | |
## brew install shivammathur/php/php@8.1 | |
## brew install shivammathur/php/php@7.4 | |
## confirm PHP 7.4 is not in the bash_profile path | |
#Switch to PHP 7.4 and Drush 8.x | |
if [[ $1 == "7.4" ]]; | |
then | |
echo "------------------ PHP 7.4 ------------------------" | |
brew unlink PHP | |
brew link --force --overwrite php@7.4 | |
# Remove the current version of drush. | |
composer global remove drush/drush | |
# Install drush version 8 | |
composer global require drush/drush:8.x | |
else | |
# Switch to PHP 8.1 and Drush 11. | |
echo "------------------ PHP 8.1 ------------------------" | |
brew unlink PHP | |
brew link --force --overwrite php@8.1 | |
# Remove the current version of drush. | |
composer global remove drush/drush | |
# Install drush version 11 | |
composer global require drush/drush | |
fi | |
# Show Me | |
echo "------------------------------------" | |
drush status | |
php --version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment