开发者

Debugging PHP - selecting a request for an Xdebug session

I work on PHP code with NetBeans and Xdebug. I use Xdebug for step-by-step debugging and the like.

I'm able to debug the flow of the default request, but not the flows generated by specific _get/_post or Ajax requests.

Anybody has an idea how can this be开发者_如何学JAVA done?

When I run the debugger, a tab in my browser opened automatically with the following URL: http://localhost/?XDEBUG_SESSION_START=netbeans-xdebug

Thanks. Gidi


Ok,

it goes this way:

At the projects tab (top left of the screen in my configuration), right click on the name of the project, and then properties => run configuration

There you have to fill 3 forms: 1. project url - the base url of the project on web, typically http://localhost 2. index file - use the browse button and go to the local copy of index.php or whatever file serves this role for you. This form should contain the path to this file in the local filesystem , not on the web 3. arguments - any arguments you wish to path to your script through the URL

This should give you the ability to choose a custom URL for debugging

A possible problem: in this process you may loose the synchronization between web addresses and the corresponding files in your system. Google "path mapping in php debugger" if you encounter issues of this nature, and take the first result (which the system wouldn't allow me to link directly). However this didn't work for me. I used server configuration to overcome this issue by redirecting URLs

Gidi

p.s. All the above doesn't explain how to pass POST variables to your script while debugging (and I indeed don't know how to do it)


Perhaps you try to start a debug session as described above. As debug target you choose the nearest page to your POST request in the workflow. Then you interact with the web service, always having the debugger in netbeans running. With the interaction the debug session holds on, so you can fill forms etc. and send the POST request. Then switch to netbeans and debug as usual.

Perhaps you have to enable 'Break at first line' in the debug options, or set up a breakpoint in the php code, where the request is dispatched, in order to ensure the debugger halts while dispatching the POST request. Then you eventually will have to give the debugger a push at every page load.

Hope it helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜