Speed up testing time by disabling xdebug

Published on December 5th, 2019

Sometime after I started using PHP 7.3 I noticed running my tests locally took much longer than before. Instead of a few seconds, the tests now took a few minutes, which is less than optimal when you try to develop in a TDD manner. I don't know how I came to think about disabling xdebug but I did. The test running time decreased to a few seconds again and for me it wasn't a pain in the ass to develop in TDD anymore :).

Disable xdebug temporarily

If you only want to disable xdebug temporarily I highly recommend adding the following two aliases to your ~/.aliases, ~/.bash_aliases or whatever other files you typically store your aliases in.

alias enxdebug="sudo phpenmod -s cli xdebug"
alias disxdebug="sudo phpdismod -s cli xdebug"

Disable xdebug completely

Place the following in your php.ini or a better place might be your php/{version}/mods-available/xdebug.ini.

xdebug.remote_autostart=0  
xdebug.remote_enable=0
xdebug.profiler_enable=0

Thanks for making it so far! I appreciate you taking the time to read through the article. To provide you with higher quality articles I need your feedback on how to write better articles. Did you enjoy the read? Do you have tips on what I could make better? Please tag me on twitter @krishankoenig or write me a mail to krishan.koenig@gmail.com.

Sign up for my newsletter

If you enjoyed this article, sign up for my newsletter to be the first to know when a new article is published.