PhpStorm本地调试已停止运行-您在安装程序中看到问题了吗?

时间:2019-10-21 08:57:15

标签: phpstorm xdebug

我曾经让PhpStorm在我的计算机上表现出色。没有浏览器扩展。我可以在任何地方放置断点,在浏览器中转到某个URL,按Enter键,然后我将自动进入给定文件中的断点。当我单步执行代码时,项目中的文件会自动打开。

现在,这真是一团糟。

首先,这是xdebug.ini中的Xdebug信息(我没有在php.ini中指定任何与Xdebug相关的信息):

zend_extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so
[xdebug]
xdebug.remote_enable=on
xdebug.default_enable=on
xdebug.remote_port=9000
xdebug.remote_host=localhost

如果我运行php -v,我会得到

PHP 7.0.15 (cli) (built: Feb 13 2017 10:30:54) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15, Copyright (c) 1999-2017, by Zend Technologies
    with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans
iMac:xdebug-2.7.2 $ 

phpinfo()显示基于我的.ini设置的相应值。

在PhpStorm中,我已将PHP CLI设置为7.0,它显示的是Xdebug 2.7.2。

enter image description here

enter image description here

对该“无法加载xdebug”消息感到好奇,但是php -v没有显示相同的消息。最初,我在php.ini和xdebug .ini中都定义了zend_extension,并且在执行php -v时会看到该消息,但是从php.ini中删除后,该消息就离开了php -v

我不知道是否需要在“构建,部署”中的“调试”设置下执行任何操作,但是默认情况下是这样:

enter image description here

此外,我将我的项目设置为与远程服务器同步,但是为了调试,我不想使用路径映射。这就是我以前的想法,关于调试会话结束的PhpStorm消息和未找到任何路径映射从来都不是问题。

这是我的Run->Config

enter image description here

过去,我不用担心起始URL。无论我在浏览器中输入什么URL,它都会触发调试。

enter image description here

这是我尝试过的有关路径映射的内容:

enter image description here

我这样做是为了查看它是否可以解决问题,但不能。

我的直觉是说这要么是Xdebug设置问题,我的run-> config问题,要么是我正在使用虚拟主机,并且某个地方有localhost条目引起了问题。

所以我很茫然。如果我选择Listen for incoming...并转到URL,则焦点不会转到具有当前断点的PhpStorm。我在浏览器中看到事情停止了,我去了PhpStorm,看到调试被触发了。但是第二步结束调试或进入调试过程就结束了。

我所做的任何明显错误?

编辑:这是我在xdebug日志中看到的内容:

[89603] W: Creating socket for 'dev.courses.com:9000', poll success, but error: Operation now in progress (19).
[89603] E: Could not connect to client. :-(
[89603] Log closed at 2019-10-21 10:42:37
[89603]
[89603] Log opened at 2019-10-21 10:42:37
[89603] I: Connecting to configured address/port: dev.courses.com:9000.
[89603] W: Creating socket for 'dev.courses.com:9000', poll success, but error: Operation now in progress (19).
[89603] E: Could not connect to client. :-(
[89603] Log closed at 2019-10-21 10:42:37

不确定错误的细节...也许这暗示了什么?我的问题是我在配置中的哪里指定localhost vs我的虚拟主机别名?也许那是什么把事情搞砸了?

2 个答案:

答案 0 :(得分:0)

您可以使用xdebug.remote_log=/tmp/xdebug.log设置来了解Xdebug试图做什么。该日志将指示正在进行哪些连接尝试,以及为什么成功。

答案 1 :(得分:0)

好吧,虽然最初并不明显,但这却是一个xdebug问题。

最初,我不认为要检查PHPStorm日志。但是PHPStorm日志显示了

Argument for @NotNull parameter 'remoteFileUrl' of com/jetbrains/php/debug/xdebug/debugger/XdebugDriver.onBreak must not be null 

搜索上面的错误将我带到

https://intellij-support.jetbrains.com/hc/en-us/community/posts/360001498520-xdebug-works-only-with-first-line

结果证明我的PHPStorm版本不适用于xdebug 2.7,所以我降级到2.6.1,一切都很好:-)

谢谢, 布莱恩