Last active
August 2, 2019 11:21
-
-
Save rakodev/b308e59a168039a767b7588ed9318017 to your computer and use it in GitHub Desktop.
Enable or Disable xdebug with php-fpm
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 | |
phpVersion=7.3 | |
if [[ "$1" == "status" ]]; then | |
if [[ -e /etc/php/${phpVersion}/fpm/conf.d/20-xdebug.ini ]]; then | |
echo "Xdebug is Enabled"; | |
else | |
echo "Xdebug is Disabled"; | |
fi | |
exit 0; | |
fi | |
if [[ -e /etc/php/${phpVersion}/fpm/conf.d/20-xdebug.ini ]]; then | |
# disable xdebug fpm | |
rm -f /etc/php/${phpVersion}/fpm/conf.d/20-xdebug.ini | |
# disable xdebug cli | |
rm -f /etc/php/${phpVersion}/cli/conf.d/20-xdebug.ini | |
echo "Disable Xdebug"; | |
else | |
# enable xdebug fpm | |
ln -sf /etc/php/${phpVersion}/mods-available/xdebug.ini /etc/php/${phpVersion}/fpm/conf.d/20-xdebug.ini | |
# enable xdebug cli | |
ln -sf /etc/php/${phpVersion}/mods-available/xdebug.ini /etc/php/${phpVersion}/cli/conf.d/20-xdebug.ini | |
echo "Enable Xdebug"; | |
fi | |
# Uncomment this line if you don't use this script in a docker container | |
#service php${phpVersion}-fpm restart |
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 | |
# if you use a docker comtainer, you also need this file | |
# edit the path according to your setup | |
docker-compose exec php-fpm bash -c './docker/xdebug-on-off.sh '$1 | |
if [[ -z "$1" || "$1" != "status" ]]; then | |
docker-compose restart php-fpm; | |
fi | |
# enable or disable xdebug | |
# ./xdebug.sh | |
# check xdebug status | |
# ./xdebug status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment