Disabling xdebug when running composer

前端 未结 18 1197
北海茫月
北海茫月 2021-01-29 21:18

When running composer diagnose, I get the following error :

The xdebug extension is loaded, this can slow down Composer a little. Disablin

18条回答
  •  醉话见心
    2021-01-29 21:26

    Rather than muddle with temporarily enabling or disabling the PHP module, when you might have concurrent processes using PHP (for example as part of a CI pipeline), you can tell PHP to point at a different module loading directory.

    While this is similar to some of the solutions mentioned above, this solves a few edge cases, which is very useful when being used by Jenkins or other CI runner which runs tests on the same machine concurrently.

    The easiest way to do this is to use the environment variable PHP_INI_SCAN_DIR

    Using this in a script or build task is easy:

    export PHP_INI_SCAN_DIR=/etc/php.d.noxdebug php composer install

    Of course you would want to prepare /etc/php.d.noxdebug first, doing something like:

    mkdir /etc/php.d.noxdebug cp /etc/php.d/* /etc/php.d.noxdebug rm /etc/php.d.noxdebug/xdebug.ini

    This means you have an environment similar to the old php environment, with only one module missing. Meaning you don't need to worry about needing to load the phar/json modules as you would with the php -n solution.

提交回复
热议问题