php PhpStorm 调试器不会在断点处停止;一直在等待 xdebug _SESSION_

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17120513/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 12:18:05  来源:igfitidea点击:

PhpStorm debugger not stopping at BreakPoints; keeps waiting for xdebug _SESSION_

phpxdebugphpstorm

提问by laggingreflex

Updated question : PhpStorm | WebMatrix (IISExpress) | Xdebug.remote_port | — Which Port(s) to put where?

更新的问题:PhpStorm | WebMatrix (IISExpress) | Xdebug.remote_port | — 将哪个端口放在哪里?



I'm running localhost web server on my Windows machine with WebMatrix and IISExpress. I've installed PHP and Xdebug in it and they both are working.

我正在使用 WebMatrix 和 IISExpress 在我的 Windows 机器上运行 localhost Web 服务器。我已经在其中安装了 PHP 和 Xdebug,它们都在工作。

I have a local WordPress install.

我有一个本地 WordPress 安装。

I'm now trying to get PhpStorm to debug it using Xdebug.

我现在正在尝试让 PhpStorm 使用 Xdebug 对其进行调试。

When I run PhpStorm it launches the web app in the browser with relevant debugging parameters in the browser.

当我运行 PhpStorm 时,它会在浏览器中使用相关的调试参数在浏览器中启动 Web 应用程序。

IDE KEY is matching

IDE KEY 匹配

ide

想法

xdebug.remote_portis configured correctly. (Later I found that this is wrong, but not erroneous. It should be port 9000)

xdebug.remote_port配置正确。(后来我发现这是错误的,但没有错误。应该是9000端口)

xdebug.remote_port

xdebug.remote_port

But it seems Xdebug never gets to communicate with PhpStorm. PhpStorm keeps listening, and the execution runs completely without stopping at any break-points.

但似乎 Xdebug 永远无法与 PhpStorm 通信。PhpStorm 一直在监听,并且执行完全运行,不会在任何断点处停止。

PhpStormPhpStorm

PhpStormPhpStorm

采纳答案by laggingreflex

There was a syntax error in php.ini. There were extra "quotes"and ;colons;.

中存在语法错误php.ini。有额外的"引号";冒号;

xdebug.remote_port

xdebug.remote_port

回答by Capy

These lines are crucial to make it work (in php.ini):

这些行对于使其工作至关重要(在 php.ini 中):

zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
xdebug.remote_autostart = 1 <-------- THIS
xdebug.remote_enable = 1 <----------- AND THIS

Without these lines xdebug never will work on phpstorm ;)

没有这些行,xdebug 永远不会在 phpstorm 上工作;)

回答by peteclark3

Try changing the xdebug listen port in your php.ini and your IDE.

尝试更改 php.ini 和 IDE 中的 xdebug 侦听端口。

Running Mac Yosemite, for me the problem was that I installed with homebrew, following a guide that used php-fpm, which uses port 9000by default (which conflicts with the xdebug default port)... Changing my xdebug.remote_portto 9001and changing the xdebug port in phpstorm fixed the problem, though I suspect this issue could happen for anyone in any IDE. I googled for the better part of a day and didn't see this solution (since I believe it's so specific to install method).. but I hope it helps someone.

运行 Mac Yosemite,对我来说问题是我安装了自制软件,遵循使用 php-fpm 的指南,9000默认使用端口(与 xdebug 默认端口冲突)......更改我xdebug.remote_port9001并更改 xdebug 端口phpstorm 解决了这个问题,但我怀疑这个问题可能发生在任何 IDE 中的任何人身上。我在谷歌上搜索了一天的大部分时间,但没有看到这个解决方案(因为我相信它对安装方法是如此具体)。但我希望它对某人有所帮助。

回答by Rotareti

Took me about an hour until I noticed that this button wasn't activated ;)

花了我大约一个小时,直到我注意到这个按钮没有被激活;)

"Run" -> "Start Listening for PHP Debug Connections"

“运行”->“开始侦听 PHP 调试连接”

enter image description here

在此处输入图片说明

回答by vlio20

First check for on what port xdebug is working on, you can find it in your php.ini under xdebug.remote_port=9123. As you can see in my case it is set to 9123.
Now open PhpStorm go to php debug, see screenshot: enter image description here

首先检查 xdebug 正在运行的端口,您可以在 php.ini 下找到它xdebug.remote_port=9123。正如你在我的例子中看到的,它被设置为 9123。
现在打开 PhpStorm 去 php debug,看截图: 在此处输入图片说明

under Xdebug you will find Debug port, make sure that its value is the same as in the php.ini file under xdebug.remote_port(9123 in my case).

在 Xdebug 下,您将找到 Debug 端口,确保其值与 php.ini 文件中的值相同xdebug.remote_port(在我的情况下为9123)。

Hope it helps

希望能帮助到你

回答by unismoke.com

For me it was changing the line:

对我来说,它正在改变线路:

xdebug.remote_host=localhost to xdebug.remote_host=myComputerIP

xdebug.remote_host=localhost 到 xdebug.remote_host=myComputerIP

( Mac user: in terminal run ifconfig to find your ip )

(Mac 用户:在终端中运行 ifconfig 以查找您的 ip)

回答by Scott Weaver

If anyone else runs into this issue and is using Vagrant, this is what finally fixed it for me:

如果其他人遇到这个问题并且正在使用 Vagrant,这就是最终为我解决的问题:

xdebug.remote_host=10.0.2.2

That needs to be the IP address of your local machine from inside the Vagrant box, and 10.0.2.2 is the default. If you ssh into your Vagrant box, it will show the IP where you logged in from if you want to confirm.

这需要是来自 Vagrant 框内的本地计算机的 IP 地址,并且 10.0.2.2 是默认值。如果您通过 ssh 进入您的 Vagrant 框,如果您想确认,它会显示您登录的 IP。

I know this isn't directly relevant to the specific setup the OP had, but this post shows up in a lot of xdebug / PhpStorm Google searches so hopefully this can help someone else.

我知道这与 OP 的特定设置没有直接关系,但是这篇文章出现在很多 xdebug / PhpStorm Google 搜索中,所以希望这可以帮助其他人。

回答by Lucas Bustamante

Could be a Firewall.

可能是防火墙。

Day 572... Still haven't slept or eaten... But I finally found the culprit: Windows Defender!

第572天……还是没睡没吃……但我终于找到了罪魁祸首:Windows Defender!

Basically, I had a firewall blocking JetBrains IDE Support chrome extension from sending data to PhpStorm through the default 127.0.0.1:63342 address.

基本上,我有一个防火墙阻止 JetBrains IDE Support chrome 扩展通过默认的 127.0.0.1:63342 地址将数据发送到 PhpStorm。

--- Edit

---编辑

Day 864... Same issue happened again, this time on Linux... But I finally found the culprit: Ubuntu Firewall!

第 864 天……同样的问题再次发生,这次是在 Linux 上……但我终于找到了罪魁祸首:Ubuntu 防火墙!

Seriously, this happened to me again a few months later, using Linux, and it was the firewall again. Disabling the firewall solved it sudo ufw disable- If you care for the firewall and want to keep it enabled, gotta dive in deep on creating some sort of whitelist for it.

说真的,几个月后这又发生在我身上,使用 Linux,又是防火墙。禁用防火墙解决了它sudo ufw disable-如果您关心防火墙并希望保持启用状态,则必须深入研究为它创建某种白名单。

回答by katmoon

PHPStorm has a build-in tool in Run > Web Server Debug Validation.

PHPStorm 在 Run > Web Server Debug Validation 中有一个内置工具。

It helped me to solve my problem.

它帮助我解决了我的问题。

enter image description here

在此处输入图片说明

回答by cchapman

I was having this same problem while trying to test a Laravel project using XAMPP on Windows in PHPStorm. I have no idea what exactly I was doing wrong, but I did get it working eventually. I followed the step-by-step instructions on the PHPStorm site here.

我在 PHPStorm 中尝试在 Windows 上使用 XAMPP 测试 Laravel 项目时遇到了同样的问题。我不知道我到底做错了什么,但最终我确实让它工作了。我按照此处 PHPStorm 站点上的分步说明进行操作

One thing I think that was not configured right was that there was no interpreter set up in the PHP menu in Settings.

我认为没有正确配置的一件事是在设置的 PHP 菜单中没有设置解释器。

I was also trying a few too many combinations of settings in my php.ini. These were the settings that I have when things were working:

我也在我的php.ini. 这些是我在工作时的设置:

zend_extension = C:\xampp\php\ext\php_xdebug-2.3.2-5.6-vc11.dll //as recommended from the Xdebug site itself 
xdebug.remote_enable=1=
xdebug.profiler_enable=1
xdebug.profiler_output_name = "cachegrind.out.%t-%s"

In my Run/Debug Configurations, I use a PHP Web Application setting, that just starts on the root of the site. (At first, I thought the appended ?XDEBUG_SESSION_START=<xxxxxxx>was a mistake, but it is not). Hopefully that might help if someone else is facing a similar issue.

在我的运行/调试配置中,我使用了一个 PHP Web 应用程序设置,它只是从站点的根目录开始。(起初,我认为附加?XDEBUG_SESSION_START=<xxxxxxx>是一个错误,但事实并非如此)。如果其他人面临类似的问题,希望这可能会有所帮助。

回答by it3xl

I also obtain this error message.
Also was troubles with the php.ini but more subtle.

我也收到此错误消息。
php.ini 也有问题,但更微妙。

Try to find and delete a row like this

尝试查找并删除这样的一行

extension=php_xdebug-...

Consider to look at my answer here for details "Xdebug - command is not available".

考虑在此处查看我的答案以了解详细信息“ Xdebug - 命令不可用”。