Disable Xdebug running Composer on Trellis

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.

Tagged in : Tagged in : , , ,
Jasper Frumau

Jasper has been working with web frameworks and applications such as Laravel, Magento and his favorite CMS WordPress including Roots Trellis and Sage for more than a decade. He helps customers with web design and online marketing. Services provided are web design, ecommerce, SEO, content marketing. When Jasper is not coding, marketing a website, reading about the web or dreaming the internet of things he plays with his son, travels or run a few blocks.