Skip to content

Instantly share code, notes, and snippets.

@Aldo-f
Created March 6, 2024 14:12
Show Gist options
  • Save Aldo-f/b857289613b7f016f9b2957fe1d17120 to your computer and use it in GitHub Desktop.
Save Aldo-f/b857289613b7f016f9b2957fe1d17120 to your computer and use it in GitHub Desktop.
restart_apaches.sh
#!/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