Debugging in new EAP's
In earlier builds, I used xdebug and google chrome with xdebug helper extension.
In PhpStorm debug settings I chose "Wait for connection with ide key".
When it was needed to debug the page I opened it, that ran debug session in IDE.
But in the latest builds everything has changed, I don't understand how to use debug.
So, how to use xdebug in new EAP's ?
Please sign in to leave a comment.
Hello Dmitry,
We didn't change workflow a lot.
For debugging with browser toolbar use our new "listen for debug connections" button.(see attached file "listen_for_debug_connections").
When the button is enabled PhpStorm can accept any debug connections from browser.
We haven't published any official guide yet, but you can learn some information about new debugger features from our blogpost about PhpStorm & WebStorm 2.0 EAP build 100.36.
Attachment(s):
listen_for_debug_connections.png
But I still need to run debug, and in this case IDE will open page(index.php) in new tab.
So, I should go to the page that I need to debug. That is different from my old workflow.
Thanks, I'll wait for this guide.
Dmitry,
Current workflow: enable "listen debug connections button", navigate in browser to page which you want to debug, press "debug" in your browser plugin, disable button after debugging.
Did you do the same?
This way is not working for me.
Settings | PHP | Debug Mappings
Set your mappings there (even if it's Local deployment)
Dmitry,
This is problem with path mappings. All mappings related to "listen" button stored in Project Settings -> PHP -> Debug Mappings.
But you can resolve this problem during debugging.
So I reproduced similar problem and make several screenshots which can helps you.
Attachment(s):
step1.png
step5.png
step4.png
step3.png
step2.png
It works. Thanks a lot.
Have I setup the mapping correctly? Why not to do it automatically?
Dmitry,
Everything is correct if your server document root == project root.
We already have related issue - WI-4291. It is possible for your case, but sometimes automatic detection is impossible.
Anyway we are working on it.
Thanks for your feedback!
Andriy,
Do you know that you can set necessary mappings by clicking on problem breakpoint?(see step2.png)
Attachment(s):
step2.png
Hi Nikolay,
I have never seen such breakpoint image/message/context menu option before (must be introduced in last 100.36 EAP build). But now I do know about it (because of your screenshots) :) .
After my first experience with new debug mappings I now always setup mappings before I start debugging (one for project root and few (depends on project) for external libraries). Therefore it works smooth for me -- no complains (except the fact that I have to setup those mappings manually -- would like to see some of my suggestions to be implemented in some way -- WI-4292 #3 & #4. But at the end of the day it is one-time job (set up mappings) unless more external libraries will be added later).
The only one complain I have with existing automapping (the one created on initial debug request when no mappings are setup at all) is the way how it's mapped: as you can see from a screenshot for WI-4291 my website root is a subfolder of the project folder (PROJECT\httpdocs). Because index.php (entry point) is located in that (PROJECT\httpdocs) folder and the rest of the code in PROJECT\app folder (and PROJECT\library), I need to re-map it manually anyway (otherwise I will not be able to step into the rest of code).
In general project folder structure can be divided into 2 major groups:
1) web-accessible root is a subfolder inside Project (usually such folders called httpdocs, public, web -- where images/css/js etc are stored) and the rest of the code (app, classes, includes, templates, temp, cache, session, logs etc) is usually in other folders outside web root. Quick Example -- symphony2 demos, possibly ZF (not sure as I'm not using it)
2) project folder = web root, then usually all code is stored in some "'private/protected" folder (can be few of them -- access is controlled by .htaccess or similar mechanism) or just mixed together with the rest of files. Quick Example -- yii demos, Magento shopping cart.
I prefer #1. The automapping is more suitable for #2 -- I have to manually alter it later by taking it 1 folder up (from httpdocs to project root). Because (fore some strange reason) PhpStorm does not has an option in Project-specific settings which would tell which folder is a webroot (like NetBeans has, for example), I do not see how this minor (but still quite inconvenient) inconvenience can be automatically resolved.
As I mentioned before -- not a big issue for me (I'm nor afraid of few manual operations) but it can be quite confusing for new/unfamiliar users (as you can easily see by the amount of forum threads on such/related subject).
I'm having similar problems with Debugging. Are there and instructions on how to set up debugging in 102.18??
Also, the last build that worked for me was 98.240 but as of today, it will not launch.
Can I still use 98.240 until I figure out/find the doc for debugging?
If no, can someone explain Mapping in terms a 10th grader can understand? When I select the conf page I think I need to add Mappings, I'm unable to do anything but simply click OK.
yep, i have the same problem with mapping. :(
Hello Andriy
Sorry for delay.
Do you have "PROJECT\app" folder and "PROJECT\library" in your inlcude path?
It is fixed in the latest EAP(102.18).
Thanks for sharing!
Hello Jim,
Sorry for delay.
We are working on such guide right now.
You need to set mappings so as to define how files on server corresponds to files in project.
Mapping is a pair /path/in/project/ <-> /path/on/server/.
Suppose you want to debug a file with path /home/nnmatveev/www/htdocs/gallery/index.php.
In your local copy the correspondent path is C:\test\phpstorm\project1\gallery\index.php.
Suppose you put a breakpoint on line 5 in the file C:\test\phpstorm\project1\gallery\index.php. So to get it work you should explain to PhpStorm what is a path of this file on server.
You can do it defining one of the following mappings:
The mapping number 3 is more general and will work for all files under C:\test\phpstorm\project1 and /home/nnmatveev/www/htdocs.
Look at the screenshot.
Consider the "Path Mappings" table. Left column is a project file tree. Select a file or a folder in the tree(C:\test\phpstorm\project1 on screenshot above), click on the cell at the right and type the correspondent path on server(/home/nnmatveev/www/htdocs).
So, you are ready to work with debugger.
I hope it will help you. Please fill free to report about any problems with debugger here.
We intrested in to make debugging as handy as possible.
Thank you for feedback!
Hello Alex,
Please follow the instruction as well and report here about results.
Thank you for feedback!
Hi Nikolay,
They are part of the project (not excluded folder) and are shown in Project view under main project branch -- therefore they are not listed in Settings | PHP.
These folders are not included in include_path variable of php.ini as well -- not even at runtime as almost all includes are handled via autoloaders and the rest are included via include/require with full path to the required file.
I will try it again next week (because "PHP on Server" configuration is now deprecated) -- got some new hardware to upgrade my PC (brand new install -- will be Win7 x64 instead of x32).
Yep, it works! Thanks. :)
You need to specify that the values in the right cell vary with the click of a mouse. For example, using icon "Edit"...
Ah yes, that was my issue. The input fields in the GUI are not as apparant on Mac. Now that I see them, I am 100% happy.
Jim,
Sorry for inconvenience, we are working on this UI.
I noticed that you use run configurations in order to initiate debug session.
Do you know about "listen debug connections" button in PhpStorm and browser toolbars/bookmarklets? You can find some info about it in http://blogs.jetbrains.com/webide/2010/12/phpstorm-webstorm-2-0-eap-build-100-32/
Thank you for feedback!
Also is the debugger restricted to Firefox only? Cause I can't get to work with any other browser? Must I had a plug-in installed in Firefox to use the new debugger?
Hello Stephen,
No, debugger works in any web browser.
Debugging with browser plugins is the most handy way. You can find several links to such plugin(for Firefox, Chrome and Safari) on xdebug official site.
Also you can try our bookmarklets for xdebug - http://blogs.jetbrains.com/webide/2010/12/phpstorm-webstorm-2-0-eap-build-100-32/.
But you can use debugger without any browser plugins - try 'PHP Web Application' run configuration.
Frankly, I think you guys complicated the debugging. In the current version, you set your environment, and select Debug. You browser of choice pops up and you off. Why the change? I feel it's more work now. And much more disruptive of the work flow. I mean, now I am forced to use a browser plugin and navigate to the page I want to debug or run it from the command line.
Can i expect it to get "smoother", since this is beta?
Stephen,
You can still use 'PHP Web Application' run configuration. Do you have issues with this configuration?
Please feel free to share your problems with debugging. Could you describe any specific cases when you get troubles with debugging?
We already have a lot of issues to be fixed in 2.0 in our tracker and we are going to smooth it.
Thank you for feedback!
Ok good. We need docs badly, as you know.
Thanks for a great product. PHPStorm has become my only development IDE.
I think there needs to be some refactoring in how servers and mappings are treated. There are at 4+ places where mappings are defined and 2+ different places where servers are defined. I'v create a separate thread to discuss - http://devnet.jetbrains.net/thread/293285.