Last active
January 6, 2021 09:21
-
-
Save burzum/75693e7812ce7894e3b83095199b80c2 to your computer and use it in GitHub Desktop.
Install php versions and modules automatically on Ubuntu
This file contains hidden or 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
#!/usr/bin/env bash | |
# https://computingforgeeks.com/how-to-install-php-on-ubuntu/ | |
phpVersions=('7.2' '7.3' '7.4') | |
modules=('cli' 'fpm' 'bcmath' 'gd' 'xml' 'mbstring' 'xml' 'curl' 'pgsql' 'imagick' 'intl' 'amqp' 'intl' 'imap' 'opcache') | |
sudo apt-get update | |
sudo apt -y install software-properties-common | |
sudo add-apt-repository -y ppa:ondrej/php | |
sudo apt-get update | |
for phpVersion in "${phpVersions[@]}" | |
do | |
moduleString="" | |
for module in "${modules[@]}" | |
do : | |
moduleString="${moduleString} php${phpVersion=""}-${module}" | |
done | |
sudo apt -y install 'php'$phpVersion | |
echo 'Installing modules...' | |
sudo apt -y install $moduleString | |
done | |
sudo update-alternatives --config php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment