Cannot load Xdebug - it was already loaded

Submitted by dravenk on Fri, 05/04/2018 - 15:48
dravenk:d8 longxianwen$ php -v
Cannot load Xdebug - it was already loaded
PHP 7.2.5 (cli) (built: Apr 26 2018 12:07:32) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
    with Zend OPcache v7.2.5, Copyright (c) 1999-2018, by Zend Technologies

检查php配置文件所在目录

dravenk:~ longxianwen$ php -i | grep -i configuration
Configuration File (php.ini) Path => /usr/local/etc/php/7.2
Loaded Configuration File => /usr/local/etc/php/7.2/php.ini
Configuration

进入PHP配置文件目录查看xdebug相关配置信息:

dravenk:~ longxianwen$ cd /usr/local/etc/php/7.2
dravenk:7.2 longxianwen$ grep -r xdebug *

出问题的原因是 php.ini 和 conf.d/ext-xdebug.ini 文件中都下面这一行内容:

zend_extension="xdebug.so"

注释掉其中一个即可。

 

Released:https://stackoverflow.com/questions/41741092/php7-cli-attempts-to-load-xdebug-twice-cannot-load-xdebug-it-was-already-lo?rq=1