Trouble with Ajax & PHP debugging

I'm used to PHP debugging with Xdebug & PHPStorm. I open PHPStorm and I choose "Start listen for PHP Debug Connections". I set a breakpoint. And then I browse to my local website, I make sure the Xdebug helper is on and when I load my page, PHPStorm jumps to the foreground with the php code halted on that line of code where I'd set a breakpoint. So everything works like it should, right?

Today I was programming some autocomplete functionality for a search input field with Ajax. When the user starts typing, an Ajax call is made to a php file that retrieves data from the db.
I tried several hours but PHPStorm doesn't start debugging the php code that my Ajax file requests. The code gets executed, but no matter how many breakpoints I create, PHPStorm doesn't start debugging these lines of code. Did I forget something? I couldn't find any help in previous topics here on the Jetbrains community... Is it because of the Xdebug Helper browser extension?

0
2 comments

Hi there,

Did I forget something?

Possibly. Although it works OK for me (debugging AJAX requests -- tested with AngularJS and jQuery) without extra moves -- xdebug debug marker (cookie) gets passed as expected.

What you can try:

1. Increase number of simultaneous debug connections in "Settings | PHP | Debug" -- that's if you already have one debug session running and want to have another in parallel.

2. Trigger breakpoint programmatically -- place xdebug_break(); into your PHP code.

3. If still nothing -- configure xdebug to attempt to debug every single request (regardless of debug cookie/parameter presence) -- xdebug.remote_autostart = 1.

P.S.
http://xdebug.org/docs/all_settings#remote_log -- enable logging on xdebug side to see if xdebug tries to debug at all or not. If not (for that specific request --- be sure to have empty log before start checking it) then most likely it does not see xdebug marker (cookie) for whatever reason.

0
Avatar
Permanently deleted user

It works when I use xdebug_break(); in my php code that gets called using Ajax, so I'm gonna use that to do my debugging... I also set the max. number of connections to 3 now and I saw in my phpinfo() that xdebug.remote_autostart was already 'on'.
Thanks!

0

Please sign in to leave a comment.