From 06dc17ac8e8cff08ff67efac4c385bacdb4cbd50 Mon Sep 17 00:00:00 2001 From: Patrik Lermon Date: Thu, 25 Feb 2016 10:04:50 +0100 Subject: [PATCH 1/6] 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. From 8a4a27e4509dd32a8a209f8a3cd78ee36db24a03 Mon Sep 17 00:00:00 2001 From: Patrik Lermon Date: Thu, 25 Feb 2016 10:27:47 +0100 Subject: [PATCH 2/6] Update troubleshooting.md --- doc/articles/troubleshooting.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/articles/troubleshooting.md b/doc/articles/troubleshooting.md index f7802115c..fd805b3f4 100644 --- a/doc/articles/troubleshooting.md +++ b/doc/articles/troubleshooting.md @@ -202,7 +202,9 @@ echo 'function composer() { COMPOSER="$(which composer)" && sudo php5dismod -s c . ~/.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**. +When executing `composer` you will run it with xdebug **disabled** (**as long as the command is executing**), +and 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. From 5e1bd000898e462ad08bbf3eae7388b2891403ed Mon Sep 17 00:00:00 2001 From: Patrik Lermon Date: Thu, 25 Feb 2016 10:28:19 +0100 Subject: [PATCH 3/6] Update troubleshooting.md --- doc/articles/troubleshooting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/articles/troubleshooting.md b/doc/articles/troubleshooting.md index fd805b3f4..531cb39d9 100644 --- a/doc/articles/troubleshooting.md +++ b/doc/articles/troubleshooting.md @@ -198,7 +198,7 @@ your setup. This also assumes that you have sudo privileges and the `php5enmod` 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 +echo 'function composer() { COMPOSER="$(which composer)" ; sudo php5dismod -s cli xdebug ; $COMPOSER "$@" && sudo php5enmod -s cli xdebug ;}' >> ~/.bash_aliases . ~/.bash_aliases ``` From 271c778300230ea74c5c94023a51c1616fc224d5 Mon Sep 17 00:00:00 2001 From: Patrik Lermon Date: Thu, 25 Feb 2016 10:43:07 +0100 Subject: [PATCH 4/6] Update troubleshooting.md --- doc/articles/troubleshooting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/articles/troubleshooting.md b/doc/articles/troubleshooting.md index 531cb39d9..96861d84a 100644 --- a/doc/articles/troubleshooting.md +++ b/doc/articles/troubleshooting.md @@ -198,7 +198,7 @@ your setup. This also assumes that you have sudo privileges and the `php5enmod` 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 +echo 'function composer() { COMPOSER="$(which composer)" && sudo php5dismod -s cli xdebug ; $COMPOSER "$@" ; STATUS=$? ; sudo php5enmod -s cli xdebug ; return $STATUS ; }' >> ~/.bash_aliases . ~/.bash_aliases ``` From 0c93bc3d0b3b1006b9d3012bbd2e22d883235e3c Mon Sep 17 00:00:00 2001 From: Patrik Lermon Date: Thu, 25 Feb 2016 11:18:41 +0100 Subject: [PATCH 5/6] Update troubleshooting.md --- doc/articles/troubleshooting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/articles/troubleshooting.md b/doc/articles/troubleshooting.md index 96861d84a..4b63938cb 100644 --- a/doc/articles/troubleshooting.md +++ b/doc/articles/troubleshooting.md @@ -198,7 +198,7 @@ your setup. This also assumes that you have sudo privileges and the `php5enmod` 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 "$@" ; STATUS=$? ; sudo php5enmod -s cli xdebug ; return $STATUS ; }' >> ~/.bash_aliases +echo 'function composer() { COMPOSER="$(which composer)" || { echo "Could not find composer in path" ; return 1 ; } && sudo php5dismod -s cli xdebug ; $COMPOSER "$@" ; STATUS=$? ; sudo php5enmod -s cli xdebug ; return $STATUS ; }' >> ~/.bash_aliases . ~/.bash_aliases ``` From 1da09f24ee598192e2adb76a285d331c92ce0e4c Mon Sep 17 00:00:00 2001 From: Patrik Lermon Date: Thu, 25 Feb 2016 12:48:46 +0100 Subject: [PATCH 6/6] Update troubleshooting.md --- doc/articles/troubleshooting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/articles/troubleshooting.md b/doc/articles/troubleshooting.md index 4b63938cb..7f339a8e5 100644 --- a/doc/articles/troubleshooting.md +++ b/doc/articles/troubleshooting.md @@ -198,7 +198,7 @@ your setup. This also assumes that you have sudo privileges and the `php5enmod` commands available. It also assumes that you have `composer` in your path. ```sh -echo 'function composer() { COMPOSER="$(which composer)" || { echo "Could not find composer in path" ; return 1 ; } && sudo php5dismod -s cli xdebug ; $COMPOSER "$@" ; STATUS=$? ; sudo php5enmod -s cli xdebug ; return $STATUS ; }' >> ~/.bash_aliases +echo 'function composer() { COMPOSER="$(which composer)" || { echo "Could not find composer in path" >&2 ; return 1 ; } && sudo php5dismod -s cli xdebug ; $COMPOSER "$@" ; STATUS=$? ; sudo php5enmod -s cli xdebug ; return $STATUS ; }' >> ~/.bash_aliases . ~/.bash_aliases ```