Eclipse Xdebug冻结在57% [英] Eclipse Xdebug Freezes at 57%

查看:224
本文介绍了Eclipse Xdebug冻结在57%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题:



从Eclipse为我的一个php页面启动调试配置时,页面在Chrome中成功打开,但Eclipse调试器冻结在57%在Eclipse的右下角),从未进一步发展。



我的设置:


  1. MAMP 2.2

  2. PHP 5.3.3

  3. Eclipse Kepler

  4. Eclipse PDT

  5. Xdebug

  6. 2个基于/ Applications / MAMP / htdocs的虚拟主机

  7. Apache Port:80

  8. MySql服务器端口:3306

我的虚拟主机设置在MAMP之内工作正常。以下是有关Xdebug设置的截图:











我怀疑这个问题是由我的虚拟主机造成的。两个虚拟主机位于/ Applications / MAMP / htdocs / ledworld和/ Applications / MAMP / htdocs / sandbox下。我目前正在尝试调试沙箱项目。



如果您可以提供详细的说明,说明我应该对附件屏幕截图进行哪些更改,或者如何设置此操作的逐步说明这将是非常好的!

解决方案

这里是任何人坚持的完整解决方案:



/Applications/MAMP/bin/php/<your_php_version>/conf/php.ini 的底部应如下所示: / p>

  [xdebug] 
zend_extension =/ Applications / MAMP / bin / php /< your_php_version> / lib / php /extensions/no-debug-non-zts-<timestamp>/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_host =沙箱
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.idekey = ECLIPSE_DBGP
xdebug.remote_log = / tmp / xdebug.log

请注意,然后将 xdebug.remote_host 选项设置为您给虚拟主机的名称。所以在我的情况下,我的httpd-vhosts.conf文件将包含一个这样的条目

 < VirtualHost *:80& 
ServerName沙箱
DocumentRoot / Applications / MAMP / htdocs / sandbox /
<目录/应用程序/ MAMP / htdocs / sandbox />
选项索引FollowSymLinks MultiViews
AllowOverride全部
订单允许,拒绝
允许从所有
< / Directory>
< / VirtualHost>

和我的 / private / etc / hosts 文件将有这样的条目

  127.0.0.1 sandbox 
>>>>>>>>>>>>>确保所选端口与上述php.ini文件中指定的端口匹配



确保接受远程会话(JIT)设置为localhostif您希望外部程序触发调试会话(例如Chrome Xdebug辅助扩展)。



Eclipse首选项 - > PHP-> Debug->安装的调试器 - > XDebug- >配置 - >





在Eclipse中添加新的或编辑现有的PHP可执行文件:



确保可执行文件路径和php.ini文件字段指向MAMP正在使用的相同版本的PHP(MAMP-> Preferences ...-> PHP-> PHP版本)您可能不需要也填写php .ini文件字段,但我也是这样做。



Eclipse首选项 - > PHP-> PHP可执行文件 - >添加/编辑 p>



在Eclipse中安装服务器:



我在MAMP(MAMP)下使用HTTP端口80 - >首选项...-> Ports-> Apache Port)。如果您使用差异端口,请确保将其包含在此屏幕中基本URL的末尾。



Eclipse首选项 - > PHP-> PHP服务器 - >新建/编辑





创建一个新的Eclipse调试配置,如下所示:



PHP服务器应该设置为上面创建的服务器。应将文件设置为要在项目中调试的php文件。如果URL字段不显示您希望在浏览器中输入您的PHP文件(即 http://< virtual_host> / path / to / file / being / debugged)。 php ,然后取消选中自动生成框,并手动修改URL字段的第二部分,以便完整的URL是您期望的。不要忘记添加任何查询参数PHP脚本期望在$ _GET变量中找到。





调试配置的调试器选项卡应如下所示:



Make确定服务器调试器设置为XDebug,我喜欢取消选中Break in First Line选项,因为我发现烦人的是总是在第一行代码中断,而是使用断点来控制调试器停止的位置。 >



这是al我应该要做。快乐调试! :)


My problem:

When launching a debug configuration from Eclipse for one of my php pages, the page opens successfully in Chrome but the Eclipse debugger freezes at 57% (in the bottom right hand corner of Eclipse) and never progresses further. The set breakpoints are never reached.

My setup:

  1. MAMP 2.2
  2. PHP 5.3.3
  3. Eclipse Kepler
  4. Eclipse PDT
  5. Xdebug
  6. 2 virtual hosts with roots at /Applications/MAMP/htdocs
  7. Apache Port: 80
  8. MySql Server Port: 3306

My virtual hosts setup within MAMP is working fine. Below are screenshots concerning the Xdebug setup:

I suspect the problem is being caused by my virtual hosts. The two virtual hosts are under "/Applications/MAMP/htdocs/ledworld" and "/Applications/MAMP/htdocs/sandbox". Im currently trying to debug the sandbox project.

If you could provide detailed instructions on what changes I should make to the attached screenshots or step by step instructions on how to set this up that would be great!

解决方案

Here is the full solution for anyone else stuck on this:

The bottom of your /Applications/MAMP/bin/php/<your_php_version>/conf/php.ini should look like this:

[xdebug]
zend_extension="/Applications/MAMP/bin/php/<your_php_version>/lib/php/extensions/no-debug-non-zts-<timestamp>/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=sandbox
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.idekey=ECLIPSE_DBGP
xdebug.remote_log=/tmp/xdebug.log

Note that then xdebug.remote_host option is set to the name you gave your virtual host. So in my case, my httpd-vhosts.conf file would containt an entry like this

<VirtualHost *:80>
    ServerName sandbox
    DocumentRoot /Applications/MAMP/htdocs/sandbox/
    <Directory /Applications/MAMP/htdocs/sandbox/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

and my /private/etc/hosts file would have an entry like this

127.0.0.1       sandbox

From the Eclipse side of things, here is what you should do.

Configure the XDebug debugger of Eclipse. Make sure that the selected port matches the port specified in the php.ini file above

Make sure that "Accept remote session (JIT)" is set to "localhost" if you want external programs to trigger debug sessions (e.g. Chrome Xdebug helper extension).

Eclipse Preferences->PHP->Debug->Installed Debuggers->XDebug->Configure->

Add a new or edit an existing PHP executable in Eclipse:

Make sure that the "Executable Path" and "php.ini File" fields point to the same version of PHP that MAMP is using (MAMP->Preferences...->PHP->PHP Version. You probably don't need to also fill in the "php.ini File" field, but I do it anyway.

Eclipse Preferences->PHP->PHP Executables->Add/Edit

Setup a server in Eclipse:

I use HTTP port 80 for Apache under MAMP (MAMP->Preferences...->Ports->Apache Port). If you use a difference port, make sure to include it at the end of the "Base URL" in this screen.

Eclipse Preferences->PHP->PHP Servers->New/Edit

Create a new Eclipse debug configuration that looks like this:

The "PHP Server" should be set to the server you created above. The "File" should be set to the php file you want to debug within your project. If the "URL" field does not show what you would expect to type into your browser to load your PHP file (namely http://<virtual_host>/path/to/file/being/debugged.php, then uncheck the "Auto Generate" box and manually modify the second part of the "URL" field so that the complete URL is what you expect. Don't forget to add any query parameters that your PHP script expects to find in the $_GET variable.

The "Debugger" tab of the debug configuration should look like this:

Make sure "Server Debugger" is set to XDebug. I like to uncheck the "Break at First Line" option because I find it annoying to always break at the first line of code. Use breakpoints instead to control where the debugger stops.

That is all you should need to do. Happy debugging! :)

这篇关于Eclipse Xdebug冻结在57%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆