When running unit tests, xdebug will slow things down quite a bit. Most of the time we run tests we don’t need xdebug because we are not doing code coverage, or actually debugging. Here is how I quickly toggle xdebug on and off as needed from the command line.

I create two shell scripts called xon.sh and xoff.sh, and I just run whichever I need to set xdebug on or off.



sed -i '' 's/;zend_extension="xdebug.so"/zend_extension="xdebug.so"/g' /usr/local/etc/php/7.4/php.ini


  sed -i '' 's/zend_extension="xdebug.so"/;zend_extension="xdebug.so"/g' /usr/local/etc/php/7.4/php.ini

Of course, the syntax will likely be different for your system, but if you have xdebug installed, and want to make your unit tests run faster, this will help.

How to quickly toggle xdebug
Tagged on: