Disabling xdebug when running composer

前端 未结 18 1219
北海茫月
北海茫月 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:41

    (Windows)

    Based on documentation I use environment variable PHPRC, so I can choose which INI file shloud be loaded, thus I can choose whether I want to enable or disable Xdebug before executing a command (like composer install).

    I have two INI files, one with Xdebug enabled (php-xdebug.ini) and one with Xdebug disabled (php.ini - it's also default one).

    I use some batches (placed in location which is included in PATH environment variable, so it can be executed from anywhere):

    To enable Xdebug I call xon.bat:

    @ECHO OFF
    set PHPRC=C:/path-to-php/php-xdebug.ini
    

    To disable Xdebug I call xoff.bat:

    @ECHO OFF
    set PHPRC=
    

    By calling php --ini I can check which INI file was loaded.

    Alternatively you can use environment variable PHP_INI_SCAN_DIR in which you set a path to directory from where additional INI files will be loaded. Advantage is that you can load multiple INI files.

提交回复
热议问题