XDebug 未在 phpinfo() 的输出中列出

XDebug not listed in the output of phpinfo()

我正在尝试启用 XDebug,以便我可以将它与 PHPStorm 一起使用(我在 Mac),虽然我没有任何错误,但 XDebug 未在 php 信息中列出() 输出。我也尝试使用 XDebug 向导,但结果相同。这是我所有的配置:

我修改了 /usr/local/etc/php/7.2/php.ini 我从中得到的:

$ php --ini:

Configuration File (php.ini) Path: /usr/local/etc/php/7.2
Loaded Configuration File:         /usr/local/etc/php/7.2/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.2/conf.d
Additional .ini files parsed:      /usr/local/etc/php/7.2/conf.d/ext-opcache.ini

具有以下内容:

zend_extension ="/usr/local/lib/php/pecl/20170718/xdebug.so"

[xdebug]
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM

xdebug.so 与 pecl 一起安装,没有任何错误:

$ pecl install xdebug

确认我有 xdebug.so:

php -m的输出如下:

[PHP Modules]
ast
bcmath
...
wddx
xdebug
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Xdebug
Zend OPcache

完成所有这些配置后我运行:

$ sudo apachectl restart

但是在 phpinfo() 的输出中我没有启用它:

我也翻遍了内容,但没有任何内容与xdebug有关。

还应注意,我在 phpinfo() 输出之前重新启动了本地服务器:

$ php bin/console server:start --force

我的 php 版本(您还可以看到它显示 Xdebug 已正确启用):

❯ php -v
PHP 7.2.27 (cli) (built: Jan 24 2020 03:49:45) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v2.9.3, Copyright (c) 2002-2020, by Derick Rethans
    with Zend OPcache v7.2.27, Copyright (c) 1999-2018, by Zend Technologies

正如@LazyOne 所建议的,我尝试重新启动我的系统,一切都开始正常工作。看起来有些东西需要重新启动才能开始使用新的 settings/configurations。因此,如果您尝试了所有方法并且从配置点来看一切看起来都不错,请尝试重新启动您的系统。