【发布时间】:2018-06-03 10:00:45
【问题描述】:
我在 PhpStorm 中使用 Codeception 为我的应用程序运行测试时出错。我的代码正在通过 Vagrant 运行。
在 Codeception 测试的 index.php 的第一行是:
ini_set('xdebug.max_nesting_level', 200);
我通过自制软件安装了 xdebug,这在我的 php 版本输出中:
PHP 7.1.12 (cli) (built: Dec 2 2017 12:15:25) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans
当我在 PhpStorm 事件日志中收到错误时运行测试时:
Cannot accept external Xdebug connection: Cannot evaluate expression 'isset($_SERVER['PHP_IDE_CONFIG'])'
在我的 PhpStorm 设置中,我将其设置为接受外部连接:
在 php 信息中我有可用的 xdebug 设置:
$ php -i | grep xdebug
Additional .ini files parsed => /usr/local/etc/php/7.1/conf.d/ext-xdebug.ini
xdebug
xdebug support => enabled
xdebug.auto_trace => Off => Off
xdebug.cli_color => 0 => 0
xdebug.collect_assignments => Off => Off
xdebug.collect_includes => On => On
...
xdebug.remote_connect_back => On => On
在/usr/local/etc/php/7.1/conf.d/ext-xdebug.ini中我根据this thread设置xdebug.remote_connect_back=1。
我该怎么做才能消除Cannot accept external Xdebug connection 错误并运行测试?
【问题讨论】:
-
嗯,
$_SERVER['PHP_IDE_CONFIG']我认为是用于远程 CLI 调试的。缺少idekey?xdebug.idekey="PHPSTORM"。已经读过了? stackoverflow.com/questions/29035705/…我的工作,但我必须点击绿色的小电话按钮“听”, -
设置 idekey 未修复或更改错误。我确实有监听调试连接的绿色电话
-
因此,使用这种方法,您将在请求中提出一个标志,告诉 IDE 进行处理。看请求,请求中的变量是怎么传入的?当我想在 IDE 中调试时,我想我已经使用了浏览器工具栏按钮来添加它。
标签: php debugging phpstorm xdebug codeception