Skip to content

Instantly share code, notes, and snippets.

@edmondscommerce
Last active January 22, 2018 12:43
Show Gist options
  • Save edmondscommerce/d3a450d77bc31573dca9bb77cdcf33a3 to your computer and use it in GitHub Desktop.
Save edmondscommerce/d3a450d77bc31573dca9bb77cdcf33a3 to your computer and use it in GitHub Desktop.
BASH Script to Upgrade PHP Version (From 7.0 to 7.1)
#!/usr/bin/env bash
# Assumes pacakages are from webtatic, might need to adjust for other repos
# @webtatic packages look like this:
# php71w-common.x86_64 7.1.7-1.w7 @webtatic
versionFrom=70
versionTo=71
yum list installed | grep php | grep $versionFrom > /tmp/php_installed
yum -y remove 'php*'
while read -r line;
do
echo $line;
package=$(echo $line | cut -d ' ' -f 1 | sed "s/$versionFrom/$versionTo/g");
echo $package;
yum -y install $package
done < /tmp/php_installed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment