When you use Trellis for local WordPress development, Xdebug is installed for debugging. This can be very useful. But when you run composer to update plugins, WordPress and so on and use Xdebug composer will become very slow. And you will get this warning

You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug

Chris Loftus wrote about it . He explained how to Disable Xdebug running Composer.  He offered a solution to keep on using Xdebug but not while running cli stuff. A solution for setups with Ubuntu and PHP 7. And As we know that is what Trellis uses. So an awesome solution how to disable Xdebug running Composer on Trellis! The solution is to run the following command:

sudo phpdismod -s cli xdebug

This will disable Xdebug for CLI purposes. To quote Chris again:

The -s flag tells it to disable Xdebug for the CLI SAPI (/etc/php/7.0/cli) and not FPM.

And that is what we are looking for. I still want to be able to use Xdebug, but I do want composer to run smoothly and as fast as possible on my local Trellis LEMP server.

Once you have run that command you will no longer get the warning. Composer will be considerably faster from that moment on.

Leave a Reply

Your email address will not be published. Required fields are marked *