我正在尝试启用 XDebug,以便我可以将它与 PHPStorm 一起使用(我在 Mac 上),虽然我没有任何错误,但 XDebug 未在 phpinfo() 输出中列出。我也尝试使用 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
肥皂起泡泡