This Question is Answered

25 Replies Last post: Jan 15, 2011 7:09 PM by David Rees  
Dmitry Butakov Newbie 12 posts since
Jul 22, 2010
Currently Being Moderated

Dec 16, 2010 1:59 PM

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 ?

Nikolay Matveev Apprentice 697 posts since
Apr 14, 2010
Currently Being Moderated
Dec 16, 2010 2:34 PM in response to: Dmitry Butakov
Re: Debugging in new EAP's

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.

Attachments:
Nikolay Matveev Apprentice 697 posts since
Apr 14, 2010
Currently Being Moderated
Dec 16, 2010 3:16 PM in response to: Dmitry Butakov
Re: Debugging in new EAP's

Dmitry,

 

But I still need to run debug, and in this case IDE will open page(index.php) in new tab.

 

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?

Andriy Bazanov Master 4,048 posts since
May 28, 2010
Currently Being Moderated
Dec 16, 2010 3:52 PM in response to: Dmitry Butakov
Re: Debugging in new EAP's

Settings | PHP | Debug Mappings

 

Set your mappings there (even if it's Local deployment)

Nikolay Matveev Apprentice 697 posts since
Apr 14, 2010
Currently Being Moderated
Dec 16, 2010 6:27 PM in response to: Andriy Bazanov
Re: Debugging in new EAP's

Andriy,

 

Do you know that you can set necessary mappings by clicking on problem breakpoint?(see step2.png)

Attachments:
Andriy Bazanov Master 4,048 posts since
May 28, 2010
Currently Being Moderated
Dec 16, 2010 7:17 PM in response to: Nikolay Matveev
Re: Debugging in new EAP's

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).

Nikolay Matveev Apprentice 697 posts since
Apr 14, 2010
Currently Being Moderated
Dec 25, 2010 8:25 AM in response to: Andriy Bazanov
Re: Debugging in new EAP's

Hello Andriy


Sorry for delay.

 

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).

 

Do you have "PROJECT\app" folder and "PROJECT\library" in your inlcude path?

 


I have to manually alter it later by taking it 1 folder up (from httpdocs to project root).

 

It is fixed in the latest EAP(102.18).

 


Thanks for sharing!

Andriy Bazanov Master 4,048 posts since
May 28, 2010
Currently Being Moderated
Dec 25, 2010 2:18 PM in response to: Nikolay Matveev
Re: Debugging in new EAP's

Hi Nikolay,

Do you have "PROJECT\app" folder and "PROJECT\library" in your inlcude path?

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.

 

It is fixed in the latest EAP(102.18).

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).

Nikolay Matveev Apprentice 697 posts since
Apr 14, 2010
Currently Being Moderated
Dec 16, 2010 3:58 PM in response to: Dmitry Butakov
Re: Debugging in new EAP's

Dmitry,

 

This way is not working for me.

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.

Attachments:
Nikolay Matveev Apprentice 697 posts since
Apr 14, 2010
Currently Being Moderated
Dec 16, 2010 6:22 PM in response to: Dmitry Butakov
Re: Debugging in new EAP's

Dmitry,

 

I have correctly setup the mapping?

Everything is correct if your server document root == project root.

 

Why not do it automatically?

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!

Jim Schlies Newbie 9 posts since
Sep 3, 2010
Currently Being Moderated
Dec 23, 2010 9:51 PM in response to: Dmitry Butakov
Re: Debugging in new EAP's

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.

Alex Voevodin Newbie 7 posts since
Dec 24, 2010
Currently Being Moderated
Dec 24, 2010 9:37 AM in response to: Jim Schlies
Re: Debugging in new EAP's

yep, i have the same problem with mapping.

Nikolay Matveev Apprentice 697 posts since
Apr 14, 2010
Currently Being Moderated
Dec 25, 2010 10:44 AM in response to: Alex Voevodin
Re: Debugging in new EAP's

Hello Alex,

 

Please follow the instruction as well and report here about results.

 

Thank you for feedback!

Nikolay Matveev Apprentice 697 posts since
Apr 14, 2010
Currently Being Moderated
Dec 25, 2010 10:44 AM in response to: Jim Schlies
Re: Debugging in new EAP's

Hello Jim,

 

Sorry for delay.

 

 

Can I still use 98.240 until I figure out/find the doc for debugging?

 

We are working on such guide right now.

 

can someone explain Mapping in terms a 10th grader can understand?

 

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:

  1. C:\test\phpstorm\project1\gallery\index.php <-> /home/nnmatveev/www/htdocs/gallery/index.php
  2. C:\test\phpstorm\project1\gallery <-> /home/nnmatveev/www/htdocs/gallery
  3. C:\test\phpstorm\project1 <-> /home/nnmatveev/www/htdocs

 

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.

hot_to_set_mappings.png

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!

Alex Voevodin Newbie 7 posts since
Dec 24, 2010
Currently Being Moderated
Dec 26, 2010 1:53 AM in response to: Nikolay Matveev
Re: Debugging in new EAP's

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"...

Jim Schlies Newbie 9 posts since
Sep 3, 2010
Currently Being Moderated
Dec 27, 2010 11:25 PM in response to: Dmitry Butakov
Re: Debugging in new EAP's

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.

Nikolay Matveev Apprentice 697 posts since
Apr 14, 2010
Currently Being Moderated
Dec 27, 2010 11:33 PM in response to: Jim Schlies
Re: Debugging in new EAP's

Jim,

 

The input fields in the GUI are not as apparant on Mac.

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!

Stephen Cox Novice 170 posts since
Aug 10, 2010
Currently Being Moderated
Dec 28, 2010 9:09 AM in response to: Nikolay Matveev
Re: Debugging in new EAP's

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?

Nikolay Matveev Apprentice 697 posts since
Apr 14, 2010
Currently Being Moderated
Dec 28, 2010 10:06 AM in response to: Stephen Cox
Re: Debugging in new EAP's

Hello Stephen,

 

Also is the debugger restricted to Firefox only? Cause I can't get to work with any other browser?

No, debugger works in any web browser.

 

Must I had a plug-in installed in Firefox to use the new debugger?

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.

Stephen Cox Novice 170 posts since
Aug 10, 2010
Currently Being Moderated
Dec 29, 2010 8:07 AM in response to: Nikolay Matveev
Re: Debugging in new EAP's

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?

Nikolay Matveev Apprentice 697 posts since
Apr 14, 2010
Currently Being Moderated
Dec 29, 2010 10:53 AM in response to: Stephen Cox
Re: Debugging in new EAP's

Stephen,

 

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?

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?

 

Can i expect it to get "smoother", since this is beta?

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!

Stephen Cox Novice 170 posts since
Aug 10, 2010
Currently Being Moderated
Dec 29, 2010 9:24 PM in response to: Nikolay Matveev
Re: Debugging in new EAP's
We already have a lot of issues to be fixed in 2.0 in our tracker and we are going to smooth it.

 

Ok good. We need docs badly, as you know.

 

Thanks for a great product. PHPStorm has become my only development IDE.

David Rees Newbie 75 posts since
Sep 14, 2002
Currently Being Moderated
Jan 15, 2011 7:09 PM in response to: Nikolay Matveev
Re: Debugging in new EAP's

NikolayMatveev wrote:

 

Stephen,

 

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?

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?

 

Can i expect it to get "smoother", since this is beta?

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!

 

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.

More Like This

  • Retrieving data ...