Last active
April 20, 2019 04:01
-
-
Save besrabasant/4415fa7881df28af93b1dd858bacd18a to your computer and use it in GitHub Desktop.
XDebug Toggler
This file contains hidden or 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
#!/bin/bash | |
# Simple script to enable or disable the xdebug extension | |
# Note that xargs removes whitespace | |
PHPINIDIR=`php --ini | head -1 | cut -d ":" -f 2 | xargs echo` | |
PHPDIR=${PHPINIDIR//"/cli"/} | |
case $1 in | |
on) | |
[ -f $PHPDIR/mods-available/xdebug.ini ] && ln -s $PHPDIR/mods-available/xdebug.ini $PHPINIDIR/conf.d/20-xdebug.ini | |
valet restart | |
echo "Xdebug is ON" | |
;; | |
off) | |
[ -L $PHPINIDIR/conf.d/20-xdebug.ini ] && rm $PHPINIDIR/conf.d/20-xdebug.ini | |
valet restart | |
echo "Xdebug is OFF" | |
;; | |
*) | |
ME=`basename "$0"` | |
if [ -L $PHPINIDIR/conf.d/20-xdebug.ini ]; then | |
. $ME off | |
else | |
. $ME on | |
fi | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment