Last active
May 3, 2024 17:52
-
-
Save floriankraemer/2f43c69b30b89b887e4ac2292df54d67 to your computer and use it in GitHub Desktop.
PHP installer script for Ubuntu
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
#!/usr/bin/env bash | |
# https://computingforgeeks.com/how-to-install-php-on-ubuntu/ | |
phpVersions=('8.1') | |
modules=('zip' 'cli' 'fpm' 'bcmath' 'gd' 'xml' 'mbstring' 'xml' 'curl' 'pgsql' 'mysql' 'imagick' 'intl' 'amqp' 'intl' 'imap' 'opcache' 'redis', 'dom') | |
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