From 06dc17ac8e8cff08ff67efac4c385bacdb4cbd50 Mon Sep 17 00:00:00 2001 From: Patrik Lermon Date: Thu, 25 Feb 2016 10:04:50 +0100 Subject: [PATCH] Update troubleshooting.md Adding a workaround for disabling xdebug while executing composer. --- doc/articles/troubleshooting.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/articles/troubleshooting.md b/doc/articles/troubleshooting.md index 9aef7c26b..f7802115c 100644 --- a/doc/articles/troubleshooting.md +++ b/doc/articles/troubleshooting.md @@ -190,6 +190,20 @@ composer update php /usr/local/bin/composer update ``` +As a workaround in bash (and other shells) you can create a function which is named `composer`, +which disables xdebug before it executes composer, and then enables it afterwards. + +Create a function in a file read by bash, like `~/.bashrc` or `~/.bash_aliases` depending on +your setup. This also assumes that you have sudo privileges and the `php5enmod` and `php5dismod` +commands available. It also assumes that you have `composer` in your path. + +```sh +echo 'function composer() { COMPOSER="$(which composer)" && sudo php5dismod -s cli xdebug && $COMPOSER "$@" && sudo php5enmod -s cli xdebug ;}' >> ~/.bash_aliases +. ~/.bash_aliases +``` + +When executing `composer` you will run it with xdebug **disabled** (**as long as the command is executing**), andy if you execute composer using explicit path (like `./composer` or `/usr/local/bin/composer`) xdebug will be **enabled**. + If you do not want to disable it and want to get rid of the warning you can also define the [COMPOSER_DISABLE_XDEBUG_WARN](../03-cli.md#composer-disable-xdebug-warn) environment variable.