简体   繁体   English

在Netbeans中调试CakePHP总是在index.php上停止

[英]Debugging CakePHP in Netbeans always stops on index.php

I've setup a CakePHP project in Netbeans and use xdebug for debugging. 我在Netbeans中设置了一个CakePHP项目,并使用xdebug进行调试。 When I start a debugging session, Netbeans stops in the root index.php file on every request. 当我启动调试会话时,Netbeans会在每个请求的根index.php文件中停止。 I have to press continue and then my breakpoints are hit. 我必须按继续然后我的断点被击中。

Is there a way to configure xdebug to avoid this behavior? 有没有办法配置xdebug以避免这种行为? It's pretty tedious having to hit continue on every request. 每次请求都要继续点击是非常繁琐的。

Thanks! 谢谢!

Answer in another post: here . 在另一篇文章中回答: 这里 Issue was not specific to CakePHP, but rather PHP debugging in general with Netbeans. 问题不是特定于CakePHP,而是特定于Netbeans的PHP调试。

Try setting web root folder to APP/webroot. 尝试将Web根文件夹设置为APP / webroot。 Right click your project and choose properties, then set your source folder to webroot. 右键单击您的项目并选择属性,然后将源文件夹设置为webroot。 Ref: cakePHP debug Netbeans 参考: cakePHP调试Netbeans

Hope it helps 希望能帮助到你

Sudhir's answer pointed me into the right direction. Sudhir的回答指出了我正确的方向。

The following worked for me: 以下对我有用:

  • Go to project properties. 转到项目属性。
  • Click on Run Configuration. 单击“运行配置”。
  • Click browse button next to [Index File] field. 单击[索引文件]字段旁边的浏览按钮。
  • Select app/webroot/index.php. 选择app / webroot / index.php。

Breakpoints finally working now!!! 断点终于工作了!!! I am sooo happy XD 我很开心XD

( PS. I just made the move from Windows to OS X. Whatever installation you are running, make sure you are editing the correct php.ini file. Even PHP veterans like myself sometimes still end up editing the wrong stupid file. ) (PS。我刚从Windows转移到OS X.无论你运行什么安装,确保你正在编辑正确的php.ini文件。甚至像我这样的PHP老手有时候仍然会编辑错误的愚蠢文件。)

Paul is correct. 保罗是对的。 This is a netbeans issue, not CakePHP. 这是一个netbeans问题,而不是CakePHP。 Uncheck "Stop at First Line". 取消选中“停在第一行”。 在此输入图像描述

The larger issue that many people face is getting debugging working in general. 许多人面临的更大问题是调试工作总体而言。 If you set the index field as user787301 suggested, then the debugger will launch to webroot/index and throw an error. 如果将索引字段设置为建议的user787301,则调试器将启动到webroot / index并抛出错误。 The solution is to only set Web Root in project properties -> sources as Sudhir suggested. 解决方案是只在Sudhir建议的项目属性 - >源中设置Web Root。

在此输入图像描述

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

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