From 9fd67e9e822a1d094f3ef29d63aa549fb72b1b13 Mon Sep 17 00:00:00 2001 From: Sullivan SENECHAL Date: Wed, 25 Nov 2015 13:58:10 +0100 Subject: [PATCH] Add alias trick on xdebug documentation part --- doc/articles/troubleshooting.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/doc/articles/troubleshooting.md b/doc/articles/troubleshooting.md index 9fc96db0c..c03395d61 100644 --- a/doc/articles/troubleshooting.md +++ b/doc/articles/troubleshooting.md @@ -146,6 +146,27 @@ locating the related `zend_extension` directive and prepending it with `;` (semi ;zend_extension = "/path/to/my/xdebug.so" ``` +If you disable this extension and still want it to be added on `php` cli command, you can deal with aliases on *nix systems: + +```sh +# Load xdebug Zend extension with php command +alias php='php -dzend_extension=xdebug.so' +# PHPUnit needs xdebug for coverage. In this case, just make an alias with php command prefix. +alias phpunit='php $(which phpunit)' +``` + +With that, all php binaries called directly **will not** have xdebug enabled +but you will still have it by prefixing them with php command. + +Example: + +```sh +# Will NOT have xdebug enabled +composer update +# Will have xdebug enabled by alias +php /usr/local/bin/composer update +``` + 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.