Skip to content

Instantly share code, notes, and snippets.

@molotovbliss
Last active September 12, 2017 08:24
Show Gist options
  • Save molotovbliss/1afcf9b3cf3af1b6fcc6bc7ae1e34bc9 to your computer and use it in GitHub Desktop.
Save molotovbliss/1afcf9b3cf3af1b6fcc6bc7ae1e34bc9 to your computer and use it in GitHub Desktop.
PHP 7.0 Easy bash xdebug toggle for Magento 2.x development
#!/bin/bash
# Simple script to enable or disable the xdebug extension
# Save to ~/bin/xdebug and chmod +x ~/bin/xdebug
# original source: https://gist.github.com/jeromegamez/0ae5bce4209cf9ae680e
case $1 in
on)
[ -f /etc/php/7.0/mods-available/xdebug.ini.deactivated ] && sudo mv /etc/php/7.0/mods-available/xdebug.ini.deactivated /etc/php/7.0/mods-available/xdebug.ini
sudo service php7.0-fpm restart
sudo service apache2 restart
echo "PHP7.0 Xdebug is ON"
;;
off)
[ -f /etc/php/7.0/mods-available/xdebug.ini ] && sudo mv /etc/php/7.0/mods-available/xdebug.ini /etc/php/7.0/mods-available/xdebug.ini.deactivated
sudo service php7.0-fpm restart
sudo service apache2 restart
echo "PHP7.0 Xdebug is OFF"
;;
*)
if [ -f /etc/php/7.0/mods-available/xdebug.ini ]; then
. ~/bin/xdebug off
else
. ~/bin/xdebug on
fi
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment