Last active
March 6, 2024 14:11
-
-
Save Aldo-f/d274d0f938d553cdbb0bf32f1537ad15 to your computer and use it in GitHub Desktop.
install_php_modules.sh
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 | |
# Update package lists | |
sudo apt-get update | |
# Upgrade installed packages | |
sudo apt-get upgrade -y | |
# Fetch all installed PHP versions | |
php_versions=$(ls /etc/php) | |
echo "Installed PHP versions:" | |
echo "$php_versions" | |
# Check if a module argument is provided | |
if [ -z "$1" ]; then | |
read -p "Enter the PHP modules to install (comma-separated): " php_modules | |
else | |
php_modules=$1 | |
fi | |
# Install PHP modules for each PHP version | |
for php_version in $php_versions; do | |
sudo apt-get install -y php$php_version-$php_modules | |
done | |
# Clean up package cache | |
sudo apt-get clean | |
# Remove unused packages | |
sudo apt autoremove -y | |
echo "PHP modules installation complete." | |
# Restart all Apaches | |
./restart_apaches.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment