Skip to content

Instantly share code, notes, and snippets.

@MagePsycho
Last active March 28, 2017 15:17
Show Gist options
  • Save MagePsycho/e6e6f4ee532bbea37c7f31ea160b264c to your computer and use it in GitHub Desktop.
Save MagePsycho/e6e6f4ee532bbea37c7f31ea160b264c to your computer and use it in GitHub Desktop.
Toggle PHP XDebug in Ubuntu
phpToggleXdebug() {
case $1 in
on)
[ -f /etc/php5/mods-available/xdebug.ini.deactivated ] && sudo mv /etc/php5/mods-available/xdebug.ini.deactivated /etc/php5/mods-available/xdebug.ini
sudo service php5-fpm restart
sudo service nginx restart
;;
off)
[ -f /etc/php5/mods-available/xdebug.ini ] && sudo mv /etc/php5/mods-available/xdebug.ini /etc/php5/mods-available/xdebug.ini.deactivated
sudo service php5-fpm restart
sudo service nginx restart
;;
status)
php -m | grep xdebug
;;
*)
echo "Usage: php:debug on|off|status"
;;
esac
}
alias php:debug="phpToggleXdebug"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment