简体   繁体   English

使用eclipse和xdebug进行调试不会超出第一行

[英]Debugging with eclipse and xdebug won't go past the first line

Yes I have tried searching on StackOverflow and Google for my problem. 是的,我曾尝试在StackOverflow和Google上搜索我的问题。 If you read the entire question you will see that I include a lot of links to previous answers that I found using both. 如果您阅读了整个问题,您会发现我包含很多链接,这些链接指向我同时使用这两个答案所找到的答案。

I have been trying to get XDebug working with Version: Juno Service Release 2 of Eclipse for about the past hour and a half and I'm running into a log of issues. 在过去的一个半小时中,我一直在尝试使XDebug与Eclipse的版本:Juno Service Release 2一起使用,并且我遇到了问题日志。 I've already solved most of my problems by using stack overflow and Google. 我已经通过使用堆栈溢出和Google解决了大多数问题。

I followed the steps here first to install the debugger. 我首先按照此处的步骤安装了调试器。

I made sure that I added the debugger as a zend_extension as mentioned in this post. 我确保按照这篇文章中的说明将调试器添加为zend_extension。

Here are the relevant lines from my php.ini file 这是我的php.ini文件中的相关行

zend_extension="/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.collect_params=4
xdebug.var_display_max_depth=999
xdebug.dump.POST=*
xdebug.dump.GET=*
xdebug.show_local_vars=1

I made sure that I edited the php.ini file for the 5.3 version of php that comes with MAMP. 我确保已为MAMP随附的5.3版本的php编辑了php.ini文件。 At this point the debugger would start even though XDebug does show up when I run php -v. 此时,即使当我运行php -v时XDebug确实出现,调试器也将启动。

Since I was still having issues I checked the logs just like someone did here . 由于我仍然遇到问题,因此就像有人在这里一样检查日志。 I noticed this error in the logs: 我在日志中注意到此错误:

PHP Fatal error:  Class 'Model' not found in ...

After checking the documentation for the latest version of CodeIgniter I noticed that all Models have to extend CI_Model and not Model. 在检查了有关CodeIgniter最新版本的文档后 ,我注意到所有模型都必须扩展CI_Model而不是Model。

I fixed that and the error is no longer being printed to the logs, but now things just don't work. 我已修复该错误,并且不再将错误打印到日志中,但是现在事情不起作用了。 The debugger won't go past the first line when I try to debug a file. 当我尝试调试文件时,调试器不会超出第一行。

I'm trying to debug my php application as a PHP CLI Application. 我正在尝试将我的php应用程序调试为PHP CLI应用程序。 When I try to debug the application as a PHP Web Application I get an error message that says: 当我尝试将应用程序调试为PHP Web应用程序时,收到一条错误消息,内容为:

No tab group defined for launch configuration type org.eclipse.php.debug.core.launching.webPageLaunch

After Googling the problem, I came across this post that suggested that you might not be able to do what I'm trying to do. 搜寻问题之后,我发现这篇文章暗示您可能无法执行我想做的事情。 Since the question was first asked in 2009, I decided to try the second suggestion and check for any updates. 自2009年首次提出问题以来,我决定尝试第二条建议并检查是否有任何更新。

After updating all of my Eclipse plugins I was still having the same problem. 更新了我所有的Eclipse插件后,我仍然遇到同样的问题。 After searching on SO some more, I saw that this guy just gave up and tried with NetBeans and got everything to work. 在搜索了更多内容之后,我看到这个人只是放弃并尝试使用NetBeans,并使所有功能正常工作。

Should I just consider the past 1.5 - 2 hours as a sunk cost and just move on to a different IDE? 我是否应该将过去的1.5到2个小时视为沉没成本,然后继续使用其他IDE?

I also had issues getting XDebug to work with Eclipse and XAMPP. 我还遇到了使XDebug与Eclipse和XAMPP一起工作的问题。 In the end I decided to go with Netbeans and it was a lot smoother getting it setup. 最后,我决定使用Netbeans,安装它变得更加顺畅。 I am still using Netbeans to date for all of my PHP development. 到目前为止,我仍在使用Netbeans进行所有PHP开发。

Possibility your Php CLI is picking wrong php.ini file ? 您的PHP CLI是否选择了错误的php.ini文件?

Please go to terminal and check which ini file is loaded by : 请转到终端,然后检查哪个ini文件已加载:

php --ini

and make sure its desired one. 并确保它是所需的。

jerrod.taylor, jerrod.taylor,

I had a lot of issues when starting use PHP,Xdebug and Eclipse. 开始使用PHP,Xdebug和Eclipse时,我遇到了很多问题。 I considered change IDE myself but I liked the challenge and found a lot of help online. 我本人曾考虑过更改IDE,但我喜欢挑战并在线找到了很多帮助。 I will try to provide you with some tips will help you. 我会尽力为您提供一些技巧,以帮助您。

First of all this is the parameters I have in my php.ini: 首先,这是我在php.ini中拥有的参数:

zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.remote_enable=On
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9060
xdebug.remote_handler="dbgp"
xdebug.remote_autostart=On

I am using local machine as remote host. 我正在使用本地计算机作为远程主机。 Adapt for your world. 适应您的世界。 This configuration works for me with CLI and Web debugging. 此配置适用于CLI和Web调试。 I am really not sure if some of them is specific for different kinds of debug. 我真的不确定其中是否某些特定于不同类型的调试。 So, lets start with all of them. 因此,让我们从所有这些开始。

Now, make sure xdebug is been supported. 现在,请确保支持xdebug。 Run the following command and see if exist something not good. 运行以下命令,查看是否存在不良情况。

php -i|grep xdebug

NOw, lets go to Eclipse. 现在,让我们进入Eclipse。 In Eclipse preferences add the correspondent PHP executable and make sure the debuger type is Xdebug. 在Eclipse首选项中,添加相应的PHP可执行文件,并确保调试器类型为Xdebug。 This step can be done navigating through Preferences->PHP->PHP Executables. 可以通过在Preferences-> PHP-> PHP Executables中导航来完成此步骤。 If you add an item, the form you ask you for the following information: 如果添加项目,则表格会要求您提供以下信息:

Name : Choose one
Executable Path : the_path_to_php_exe
PHP Ini file : you can leave it blank
SAPI type : CLI
PHP debugger : Xdebug

This step is important. 这一步很重要。 It is how we will tell eclipse the executable to use. 这就是我们告诉eclipse可执行文件使用的方式。

Now, lets add a debug configuration. 现在,让我们添加一个调试配置。 I have one project called upload in my workspace and exist a file index.php on this project. 我的工作区中有一个名为上载的项目,并且在该项目上存在一个文件index.php。 To create a debug configuration click in new when "PHP CLI Application" is selected. 要创建调试配置,请在选择“ PHP CLI Application”时单击“新建”。 It will be add a new configuration form for you. 它将为您添加一个新的配置表格。 For my Debug configuration I have the following information: 对于我的调试配置,我具有以下信息:

Tab PHP Script


Run Time PHP
   Alternat PHP: (Select the PHP executable you have created above)
PHP File : /upload/index.php
Break Point : Break at first line is selected

This steps should be enough to you solve your issues. 此步骤应该足以解决您的问题。 Let us know how it was. 让我们知道情况如何。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM