Skip to content

Instantly share code, notes, and snippets.

@andreyserdjuk
Last active May 22, 2019 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreyserdjuk/3acea439edb78f413cc0ee7825ba5d0f to your computer and use it in GitHub Desktop.
Save andreyserdjuk/3acea439edb78f413cc0ee7825ba5d0f to your computer and use it in GitHub Desktop.
xdebug toggle script
unamestr=`uname`
PHP_INI_PATH=$(php --ini | egrep -o '\S+php.ini$')
if [ -z $(php -m | grep xdebug) ]; then
if [[ "$unamestr" == 'Linux' ]]; then
sudo sed -i "s/^;zend_extension/zend_extension/" $PHP_INI_PATH
elif [[ "$unamestr" == 'Darwin' ]]; then
sudo sed -i "" "s/^;zend_extension/zend_extension/" $PHP_INI_PATH
fi
echo 'Xdebug enabled'
else
if [[ "$unamestr" == 'Linux' ]]; then
sudo sed -i "s/^zend_extension/;zend_extension/" $PHP_INI_PATH
elif [[ "$unamestr" == 'Darwin' ]]; then
sudo sed -i "" "s/^zend_extension/;zend_extension/" $PHP_INI_PATH
fi
echo 'Xdebug disabled'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment