Created
May 16, 2019 15:42
-
-
Save combs/aa0c422ee2aece8f6d55e38c86126976 to your computer and use it in GitHub Desktop.
This script looks for previously installed apt packages for PHP extensions, and reinstalls them with a version you provide. E.G., php7.1-zip -> php7.3-zip
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 | |
if [ -z $1 ] | |
then | |
echo "Usage: $0 7.3 to install php7.3 modules" | |
exit | |
fi | |
echo "Fetching packages... Your sudo password may be required:" | |
packages=`sudo dpkg --get-selections | grep -v deinstall | grep php | awk '{{ print $1 }}' | sed -e 's:^php.\..[-]*::' | sort | uniq` | |
echo "About to install php $1 extensions: $packages" | |
echo "Ctrl+C to abort" | |
sleep 5 | |
for arg in $packages | |
do sudo apt-get install -y php$1-$arg | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment