Last active
January 18, 2017 10:55
-
-
Save connordavison/51ef74d19389c5c3adcd306a743cb772 to your computer and use it in GitHub Desktop.
Toggle Xdebug
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 | |
| XDEBUG='zend_extension.*=.*xdebug' | |
| function xdebug_on { | |
| if grep -q "^;$XDEBUG" $1; then | |
| echo "Enabling Xdebug $1" | |
| cat $1 | sudo sed -i.bak "s|^;\($XDEBUG\)|\1|g" $1 | |
| fi | |
| } | |
| function xdebug_off { | |
| if grep -q "^$XDEBUG" $1; then | |
| echo "Disabling Xdebug in $1" | |
| cat $1 | sudo sed -i.bak "s|^\($XDEBUG\)|;\1|g" $1 | |
| fi | |
| } | |
| case "$1" in | |
| on) ;; | |
| off) ;; | |
| *) echo "Usage: xdebug on|off" | |
| echo | |
| echo "N.B.: update the default mlocate.db before this command, and" | |
| echo "restart apache afterwards." | |
| exit 1 ;; | |
| esac | |
| for INI in $(locate php.ini xdebug.ini | grep -v \.bak\$); do | |
| xdebug_$1 $INI | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment