PhpStorm - xDebug on demand not attaching

女生的网名这么多〃 提交于 2019-12-19 11:47:39

问题


I tried out your new feature "xedbug on demand". I stuck to these guides (https://www.jetbrains.com/help/phpstorm/2016.3/configuring-xdebug.html and https://blog.jetbrains.com/phpstorm/2016/06/xdebug-on-demand-for-cli-php-scripts-in-phpstorm-2016-2-eap/).

I see that in the php Server menu when I add the path to the xdebug that PhpStorm recognizes it (the label switches from "not installed" to "XDebugger 2.4.1").

So everything seems to be fine but when I use the debugger via the bug-icon, it never attaches/stops for the breakpoint.

I activated the xdebug-Logfile, but it stays completely empty.

Furthermore I commented everything xdebug-related out in the php.ini.

The xdebug-port is still on 9000 (default).

Any ideas what I can do about it?

Update: I'm using the debugger via phpStorm's "PHP Web Application" and the debug-icon. I'm debugging php files which are executed via an apache vHost.

PS: Checked IntelliJ forum and Stack posts, didn't find anything helpful though...


回答1:


"Xdebug in demand" option works for CLI debugging only (Run/Debug Configuration of "PHP Script" type; will also work for other CLI-mode configs, e.g. "PHPUnit") be it local or remote.

Quote from the aforementioned introduction blog post:

To use the great new feature, first, you need to disable Xdebug for command line PHP scripts.


That option does not work for web pages served via web browser (e.g. Apache/nginx/IIS) or when just listening for any incoming debug connections (Zero-config approach) where actual debug is initiated outside of IDE.

The reason is very simple: when launching debugger in CLI mode, IDE launches your php executable (your configured PHP Interpreter, e.g. php.exe on Windows) with additional parameter (-z -- check php --help output or here) that can load such additional extension.

But ... when you debugging web page ... then whole PHP is not controlled by PhpStorm -- it's your web server (Apache/nginx/IIS/etc) that communicates with PHP .. and you cannot pass such argument to such scripts here.



来源:https://stackoverflow.com/questions/41673835/phpstorm-xdebug-on-demand-not-attaching

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!