Paul
Paul

Reputation: 3954

Debugging CakePHP in Netbeans always stops on index.php

I've setup a CakePHP project in Netbeans and use xdebug for debugging. When I start a debugging session, Netbeans stops in the root index.php file on every request. I have to press continue and then my breakpoints are hit.

Is there a way to configure xdebug to avoid this behavior? It's pretty tedious having to hit continue on every request.

Thanks!

Upvotes: 4

Views: 2437

Answers (4)

Bryan
Bryan

Reputation: 17581

Paul is correct. This is a netbeans issue, not CakePHP. Uncheck "Stop at First Line". enter image description here

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. The solution is to only set Web Root in project properties -> sources as Sudhir suggested.

enter image description here

Upvotes: 1

Dieter Gribnitz
Dieter Gribnitz

Reputation: 5208

Sudhir's answer pointed me into the right direction.

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.

Breakpoints finally working now!!! I am sooo happy 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. )

Upvotes: 4

Paul
Paul

Reputation: 3954

Answer in another post: here. Issue was not specific to CakePHP, but rather PHP debugging in general with Netbeans.

Upvotes: 5

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

Try setting web root folder to APP/webroot. Right click your project and choose properties, then set your source folder to webroot. Ref: cakePHP debug Netbeans

Hope it helps

Upvotes: 4

Related Questions