Disabling xdebug when running composer

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

    I came up with an answer that works pretty well for OSX, and could probably be adapted for any PHP version that loads its extensions using individual .ini files in the "additional ini dir":

    #!/bin/sh
    
    function php-no-xdebug {
        local temporaryPath="$(mktemp -t php-no-debug)"
    
        find /opt/local/etc/$1/php.ini /opt/local/var/db/$1/*.ini ! -name xdebug.ini | xargs cat > "$temporaryPath"
        php -n -c "$temporaryPath" "${@:2}"
        rm -f "$temporaryPath"
    }
    
    alias composer="php-no-xdebug php56 ~/bin/composer"
    

提交回复
热议问题