How to debug symfony in Netbeans? I cannot call sp

2020-07-27 02:06发布

问题:

I've already read posts like Passing PHP arguments into NetBeans into a page that features symfony url-routing but I cannot make things work.

I would like to run the following page:

http://localhost/s/web/frontend_dev.php/travel

So I tried first the "Local Website Configuration" with Netbeans 6.9.1. As stated in the linked thread there is an issue here since I can point to the project url and to the "web/frontend_dev.php" index file but I am not able to have "/travel" as an argument since Netbeans always prefixes it with ? for parameter passing which I don't want.

I the mentioned thread the solution is supposed to be using the Script Config option. Fine I can point to php.exe and I can point to the index file again at web/frontend_dev.php but although I can pass arguments like /travel there it still does not work since it creates a whitespace in the call:

php.exe ./web/frontend_dev.php /travel

which does not work either.

回答1:

It is easier to use the following:

  1. Set the Debug URL to "Do not open Webbrowser" (Project->Properties->Run Configuration->Advanced)

  2. Start the debugging session with Netbeans (Netbeans doesn't start a browser but waits for a XDebug connection)

  3. Use the easy XDebug-Firefox-Plugin to start XDebug for you Symfony App (easy XDebug)

Thats it. This is working perfectly for my Symfony apps



回答2:

As far as I undersand you, this is a std-situation when there is no 101-path-mapping from file-path to URL-path.

In Eclipse you can either define a completely new path-mapping or make Eclipse request a certain URL-path. In your case you would just define localhost as your server and '/s/web/frontend_dev.php/travel' as the path to attach.

I'm pretty sure there is a similar option in NetBeans as this is in times of mod-rewrite and Zend FW a very common situation.