Xdebug tends to slow down a lot of things. Here's a hack to unload the extension by default but load it whenever it's needed (for instance, when generating php code coverage.
If you use brew to install php 7, should be here: /usr/local/etc/php/<version>/conf.d/ext-xdebug.ini
. Edit that file (replacing <version>
with whatever version of php you're using) and comment out the line that begins with zend_extension
. The code examples here assume 7.0
.
;zend_extension="/usr/local/opt/php70-xdebug/xdebug.so"
If you don't use brew, do the exact same thing, but you'll need to find where your xdebug config is. Try running
vim `php -i | grep 'ext-xdebug.ini'`
Use bash aliases to allow you to load xdebug if you run php directly:
alias php='php -dzend_extension=/usr/local/opt/php70-xdebug/xdebug.so'
alias phpunit='php $(which phpunit)'
If you have any php cli's that run anything that requires Xdebug (test coverage, etc), you may need to run them through your php alias to make sure they run with xdebug enabled. But now everything else will run with is disabled, speeding things up.