Debugger not activating on form submission
I've been having a hard time with the debugger. I finally got the zero-configuration method working, kind of.
If I start a debug session and navigate to the URL directly the debug gets picked up as expected.
If I use a form submit button to navigate to one of my URLs, say with some POST data, the debugger won't pick it up. However, if I navigate from the browser url bar to the same location that the form submits to, the debugger does pick it up.
Any idea what the difference would be to the debugger/ide of visiting a URL directly from the URL bar in the browser vs. having a form submit to the URL?
Please sign in to leave a comment.
Hello Michael,
In order to trigger debugger to connect to IDE you need to set special cookie value. For more details see(it is about Xdebug, but Zend Debugger works in the same way) - http://xdebug.org/docs/remote#browser_session.
Please check that the required cookie value remains in your submit request.
If you use Xdebug please look at 'xdebug.remote_autostart' configuration option. When the option is enabled the debugger will try to connect on every request (regardless of cookie). See more details here - http://xdebug.org/docs/remote#remote_autostart
Thank you for feedback!
Are you suggesting that if the autostart setting is configured to 1 that I should not need the cookies and that clicking submit on the form would be able to trigger the debugger? I am coming from eclipse and to be completely honest, I'm not sure how I had eclipse configured but it would hit the debugger everytime if I had accept connections enabled for the debugger. It was annoying because any website I went to attempted to connect to the eclipse project even if it was unrelated to my project.
Here are my xDebug settings if it helps:
zend_extension="/home/michael/Code/xdebug/modules/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.profiler_output_dir="/etc/php5/tmp/xdebugprofiletmp"
xdebug.idekey="phpstorm4404"
I have Phpstorm IDE xdebug proxy registered as:
phpstorm4404
localhost
9000
I have a server configured in Phpstorm for
localhost
80
I have php path pointed to the same path that apache and cli use for php on the server. The IDE and server are on the same machine.
The settings above perform the same way as before. If I hit a URL with a form submit vs. just going to the URL directly the debuger doesn't get hit. Very strange. If there is anything else I can send to help figure out what's going on it would be greatly appreciated. Thanks for responding.
I just found out that it was not going to the form due to csrf protection I had enabled. My fault. Seems to be working.
However now I cannot get the debugger to pop up when running a script (phpunit) from the command line.
A warning pops up in Phpstorm that says
Cannot accept external Xdebug connection
Cannot evaluate expression '$_SERVER['SERVER_PORT']'
I set this value to 9000 as the first line in my bootstrap file. But still no luck.
Found a way to get it to work. Just wanted to update this incase others needed help. Modiifed title to also include phpunit tag.
I was not able to get the command line to trigger the debug session, but I was able to create a phpunit.xml configuration file and use the Phpstorm Phpunit run configuration with the debug play button to debug my phpunit test cases.
Michael,
Disable 'xdebug.remote_autostart' option or disable 'Listen PHP debug connections' button. It is fixed in PhpStorm 3.0 EAP (see http://youtrack.jetbrains.net/issue/WI-5132) - http://confluence.jetbrains.net/display/WI/Web+IDE+EAP.
Thank you for feedback!
Michael,
Thanks for sharing!