我正在尝试启用XDebug,以便可以将其与PHPStorm一起使用(我在Mac上),尽管我没有任何错误,但phpinfo()输出中未列出XDebug。我也尝试使用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的建议,我尝试重新启动系统,一切开始正常运行。似乎需要重新启动才能开始使用新的设置/配置。因此,如果您尝试了所有操作,并且从配置角度看一切都不错,请尝试重新启动系统。