php eclipse xdebug 会话永远不会完成
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2374567/
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
eclipse xdebug session never completes
提问by Scott Szretter
I am trying to get xdebug working with eclipse (3.5) / php (on xampp windows 7). I have verified xdebug is enabled in php - I have the fancy output and my phpinfo shows all the xdebug stuff. I have remote debug on, and typed in the lan ip address on my eclipse machine.
我正在尝试让 xdebug 与 eclipse (3.5)/php(在 xampp windows 7 上)一起工作。我已经验证在 php 中启用了 xdebug - 我有漂亮的输出,我的 phpinfo 显示了所有 xdebug 的东西。我打开了远程调试,并在我的 eclipse 机器上输入了 lan ip 地址。
When I tell eclipse to debug, it launches the browser and passes the debug URL parameters. That looks OK.
当我告诉 eclipse 进行调试时,它会启动浏览器并传递调试 URL 参数。那看起来不错。
However, in eclipse debug perspective it shows 'launching myproject' 57% 'waiting for xdebug session'. It sits there forever.
但是,在 Eclipse 调试透视图中,它显示 'launching myproject' 57% 'waiting for xdebug session'。它永远坐在那里。
I have turned off windows firewall on both machines.
我已经关闭了两台机器上的 Windows 防火墙。
I tried turning implicit flush on.
我尝试打开隐式冲洗。
Any ideas?
有任何想法吗?
回答by Goran
I had this problem too and I was missing this line in the php.inifile:
我也有这个问题,我在php.ini文件中遗漏了这一行:
xdebug.remote_enable = On
回答by uicoded
Make sure you defined zend_extention with ABSOLUTEpath in the php.ini:
确保您在以下文件中使用ABSOLUTE路径定义了 zend_extention php.ini:
e.g.: zend_extension=D:\SANDBOX\server\php\php_xdebug-2.1.0-5.3-vc6.dll
例如: zend_extension=D:\SANDBOX\server\php\php_xdebug-2.1.0-5.3-vc6.dll
I'm debugging a local project on Windows. So far I did not need xdebug.remote_enable = On.
我正在 Windows 上调试本地项目。到目前为止我不需要xdebug.remote_enable = On.
Suggestions if the Xdebug session does not start (hangs at 57 %), make sure that:
如果 Xdebug 会话未启动(在 57% 时挂起),请确保:
zend_extentiondirective is set with absolute path and the debug is loaded, usephpinfo()to check- firewall does not block the default 9000 port or Eclipse.
- another application is not using the port (execute:
netstat -an |find /i "listening"from the command line)
zend_extention指令设置为绝对路径并加载调试,用于phpinfo()检查- 防火墙不会阻止默认的 9000 端口或 Eclipse。
- 另一个应用程序没有使用该端口(执行:
netstat -an |find /i "listening"从命令行)
If you need to setup a different port use in php.ini:
如果您需要设置不同的端口,请使用php.ini:
xdebug.remote_enable = on
xdebug.remote_port = XXXX
and correct the Xdebug settings in Eclipse:
并更正 Eclipse 中的 Xdebug 设置:


回答by marco
I had the same problem and I fixed it by changing the port to XDebug (now using port 9001).
我遇到了同样的问题,我通过将端口更改为 XDebug(现在使用端口 9001)来修复它。
Here is my php.ini content:
这是我的 php.ini 内容:
zend_extension ="C:\...\EasyPHP-5.3.3\php\ext\php_xdebug-2.dll"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.profiler_enable=0
xdebug.remote_mode=req
xdebug.remote_autostart=0
Also check the apache log file and make sure that you don't have the following Warning message:
还要检查 apache 日志文件并确保您没有以下警告消息:
PHP Warning: Xdebug MUST be loaded as a Zend extension in Unknown on line 0
Warning: Xdebug MUST be loaded as a Zend extension in Unknownon line 0
PHP 警告:Xdebug 必须在第 0 行的 Unknown 中
作为 Zend 扩展加载
警告:Xdebug 必须在第0行的Unknown 中作为 Zend 扩展加载
If you do, open the php.ini file and comment with a ';' the extension=php_xdebug-2.dllline:
如果这样做,请打开 php.ini 文件并用“;”注释 该extension=php_xdebug-2.dll行:
;extension=php_xmlrpc.dll
extension=php_xsl.dll
**;extension=php_xdebug-2.dll**
;/PHPExt
回答by cloudwhale
After fighting for 3 hours and trying out every solution on forums, I found out that the simple trick was to remove the quotes while specifying the path of the Xdebug dllin zend_extensionin php.ini. I am using XAMPP (PHP 5.3.6 + Apache 2.2)+ Eclipse Indigo + PDT + Xdebug 2.1.2 on Windows Vista.
3小时的战斗,并尝试在论坛上每一个解决方案之后,我发现,简单的诀窍是删除引号,而指定的DLL Xdebug的路径中 的zend_extension在php.ini中。我在 Windows Vista 上使用 XAMPP(PHP 5.3.6 + Apache 2.2)+ Eclipse Indigo + PDT + Xdebug 2.1.2。
Here is the exact configuration that worked for me -
这是对我有用的确切配置-
zend_extension=C:\xampp\php\ext\php_xdebug-2.1.2-5.3-vc6.dll
#Note that the path above is not in quotes
xdebug.remote_enable=true
xdebug.remote_host=localhost
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir=C:\xampp\tmp
I have used port 9001 so that it does not clash with 9000 in case that's already used by another program. Make sure this matches the port in Eclipse > Preferences > PHP > Debug > Xdebug too. Also, restart apache after editing php.ini.
我使用了端口 9001,这样它就不会与 9000 发生冲突,以防它已被另一个程序使用。确保这也与 Eclipse > Preferences > PHP > Debug > Xdebug 中的端口匹配。另外,编辑php.ini后重启apache。
Once I added this to php.ini, everything worked like ice cream.
一旦我将它添加到 php.ini,一切都像冰淇淋一样工作。
回答by Artur K?dzior
I had the same problem with Zend Studio. I have noticed that the xdebug session was not starting properly. I passed this string to the url once and it worked since then.
我在 Zend Studio 上遇到了同样的问题。我注意到 xdebug 会话没有正确启动。我曾经将此字符串传递给 url,从那时起它就开始工作了。
http://localhost/myalias/?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=13750956767461
I'm sure it's a matter of configuration somewhere in the IDE.
我确定这是 IDE 中某处的配置问题。
回答by Velja Radenkovic
I realized that TCP port was in use and that was the reason why it was hanging. I changed port in php.ini and eclipse settings.
我意识到 TCP 端口正在使用中,这就是它挂起的原因。我在 php.ini 和 eclipse 设置中更改了端口。
回答by knb
Check that Eclipse's web browser settings are correct.
检查 Eclipse 的 Web 浏览器设置是否正确。
Window/Preferences/General/Web Browser/external Web Browsers/Edit settings
窗口/首选项/常规/网络浏览器/外部网络浏览器/编辑设置
In my case, the path to the external web browser binary was incorrect. It said "/usr/bin/mozilla" instead of "/usr/bin/firefox". Don't know how this setting came about, but after changing it the firefox browser window came up at last.
就我而言,外部 Web 浏览器二进制文件的路径不正确。它说“/usr/bin/mozilla”而不是“/usr/bin/firefox”。不知道这个设置是怎么来的,但更改后,firefox浏览器窗口终于出现了。
回答by Mir
I looked into apache log and there were many lines with file not found error.
我查看了 apache 日志,发现有很多行文件未找到错误。
Run -> Debug configurations -> PHP web page -> Your_configuration
运行 -> 调试配置 -> PHP 网页 -> Your_configuration
I unchecked auto generateand set filename to index.php.
我取消选中auto generate并将文件名设置为index.php.
It seems that in case of any mistake that prevents eclipse from normal functioning causes this "waiting for session"
似乎在任何阻止 eclipse 正常运行的错误的情况下都会导致这种“等待会话”
回答by Ryan Litwiller
I had the exact same problem. My configs were par with yours and in addition to having xdebug.remote_enable = Onin the php.inifile also adding the following:
我有同样的问题。我的配置与你的一样,除了xdebug.remote_enable = On在php.ini文件中还添加了以下内容:
xdebug.remote_connect_back=1
this enables multihost remote debugging, as an alternative you can define the host IP.
这将启用多主机远程调试,作为替代方案,您可以定义主机 IP。
xdebug.remote_host=IP_ADDRESS
回答by Sameer Awate
For me, adding the [xdebug]configurations suggested by others to a php.ini file kept in following path C:\wamp64\bin\apache\apache2.4.23\bin helped. Essentially it's a symbolic link that points/links to phpForApache.ini file under your respective php version folder that gets installed with wamp64 e.g. php5.6.25.
对我来说,将其他人建议的[xdebug]配置添加到保存在以下路径 C:\wamp64\bin\apache\apache2.4.23\bin 中的 php.ini 文件中有所帮助。本质上,它是一个符号链接,指向/链接到您各自的 php 版本文件夹下的 phpForApache.ini 文件,该文件安装了 wamp64,例如 php5.6.25。
In nutshell, adding following lines phpForApache.inito helped me -
简而言之,添加以下几行phpForApache.ini来帮助我 -
zend_extension = c:\wamp64\bin\php\php5.6.25\ext\php_xdebug-2.5.1-5.6-vc11-x86_64.dll
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
Hope this helps
希望这可以帮助

