Skip to content

Instantly share code, notes, and snippets.

@FinBoWa
Last active December 12, 2017 00:07
Show Gist options
  • Save FinBoWa/9e54697233284bdf0302a67ccc5f4f81 to your computer and use it in GitHub Desktop.
Save FinBoWa/9e54697233284bdf0302a67ccc5f4f81 to your computer and use it in GitHub Desktop.
Xdebug on
#/bin/sh
CURRENT_USER=`whoami`
if [ "$CURRENT_USER" == "vagrant" ]; then
cd /vagrant; ./xdebug.sh off
else
vagrant ssh -c "cd /vagrant; sudo ./xdebug.sh off"
fi
#/bin/sh
CURRENT_USER=`whoami`
if [ "$CURRENT_USER" == "vagrant" ]; then
cd /vagrant; ./xdebug.sh on
else
vagrant ssh -c "cd /vagrant; sudo ./xdebug.sh on"
fi
#!/bin/bash
#
# Simple toggle script for Xdebug
#
# Author : Kevin Hill
# Date : 2/24/2016
#
#
##################################
# Variables
##################################
#
PHP_DIR="/etc/php.d/"
INI="xdebug.ini"
XDEBUG='zend_extension="\/usr\/lib64\/php\/modules\/xdebug.so"'
##################################
# Script
##################################
#
cd $PHP_DIR
case "$1" in
on)
if grep -q "^;$XDEBUG" $INI; then
echo "Enabling Xdebug"
cat $INI | sed -i.bak "s/^;$XDEBUG/$XDEBUG/g" $INI
sudo service php-fpm restart
else
echo "Already Enabled"
fi
;;
off)
if grep -q "^$XDEBUG" $INI; then
echo "Disabling Xdebug"
cat $INI | sed -i.bak "s/^$XDEBUG/;$XDEBUG/g" $INI
sudo service php-fpm restart
else
echo "Already Disabled"
fi
;;
*)
echo "Usage: xdebug [on|off]"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment