Created
March 6, 2024 14:12
-
-
Save Aldo-f/b857289613b7f016f9b2957fe1d17120 to your computer and use it in GitHub Desktop.
restart_apaches.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 | |
# Switch Xdebug state for different PHP configurations | |
PHP_VERSIONS=($(ls /etc/php/ | grep -E '^[0-9]+\.[0-9]+$')) | |
PHP_SAPI=("cli" "fpm") # Add more SAPIs if needed | |
APACHE_RESTART_COMMAND="sudo /etc/init.d/apache2 restart" | |
for version in "${PHP_VERSIONS[@]}"; do | |
for sapi in "${PHP_SAPI[@]}"; do | |
# Restart PHP-FPM service for the current version | |
if [ "$sapi" == "fpm" ]; then | |
sudo /etc/init.d/php${version}-${sapi} restart | |
fi | |
done | |
done | |
# Restart Apache | |
$APACHE_RESTART_COMMAND |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment