PHPStorm, XDebug, XAMPP, Drupal Remote
Okay so I have XAMPP setup on my windows PC with Drupal installed using bitnami. I have the trial version of PHPStorm located on my Mac machine where I would like to debug my php code.
I went through setting up XAMPP and XDebug and these are the results from http://xdebug.org/wizard.php
You're already running the latest Xdebug version
Looks like it's installed.
I added a PHP Web Application in Run/Debug Configuration with my server information and Server.
I hit the phone icon, and attempt to put a break point somewhere within a module I'm working on in Drupal. I navigate to the page when the browser opens and it doesn't break.
请先登录再写评论。
I would like to add that when I try to access my XAMPP main web page at http://XAMPP-SERVER-IP/xampp/ PHPStorm decides to break on the index.php for an unexplained reason.
It says "Remote file path 'C:\xampp\htdocs\xampp\index.php\ is not mapped to any file path in the project"
So I'm assuming PHPStorm connects to XDebug just fine but it's not working correctly with the drupal side of things.
If I get this working I'm definiately buying phpstorm since I'm coming from Coda 2 that has no debugging but I can't get the debugging to work.
Any help is appreciated.
Hi there,
And how did you configured your xdebug ? (please show settings from php.ini as well as corresponding output from phpinfo(); )
Useful links (if followed correctly, it is enough to make it working):
Have you configured path mappings (Preferences | PHP | Servers) ?
In any case: please provide more info about your configuration (screenshots)
I will take a look at the links and provide screenshots of my configuration.
This is my php.ini file
[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "192.168.0.10"
xdebug.trace_output_dir = "C:\xampp\tmp"
xdebug.idekey = "16065"
xdebug
I attached a few screenshots. I think that's everything.
Attachment(s):
Screen Shot 2013-06-19 at 11.51.49 AM.png
Screen Shot 2013-06-19 at 11.52.21 AM.png
As I understand 192.168.0.10 is IP of your Mac. If so -- xdebug seems to be configured correct (just by looking at the values)
You have xdebug.remote_autostart=1 -- so no surprises here -- xdebug will attempt to debug EVERY single page, even if it is belongs to completely different website. This option means that you do not need to use any bookmarklet/browser extension/query param to init session -- all what you need is to activate that "phone handle" icon.
You can prevent PhpStorm from reacting to such requests (when file is outside of the project) -- check "Preferences | PHP | Debug", it has few options there. But do it only after you will actually make debugging to work.
Now .. back to the subject:
I removed the PHP->Servers so I could recieve the prompt for configuring it when I go to the page. It does pop up but the file I'm trying to debug is not index.php, it's logo_management.module and I can't seem to select it.
Attachment(s):
Screen Shot 2013-06-19 at 12.26.57 PM.png
Well .. I do not know all the details (how Drupal works .. and where modules are located etc) .. but I believe (strongly believe) that the file PhpStorm offers is actually correct and you should accept this mapping. As far as I'm aware URL rewriting is in use .. so the details quite likely to be correct as all requests should go trough single entry point: index.php (and then inside it's routed further).
On your previous screenshot (the opne that has mappings set manually) you have set the remote root folder to be c:\xamp\apps\drupal\htdocs
Here IDE tells us that file that currently is debugged is c:\xamp\apps\drupal\htdocs\index.php (same folder as above)
If you accept such mapping -- what would happen? Will it work .. or will IDE ask for another mapping etc?
BTW -- have you ever renamed any folder in this path: /Users/Rich/PhpstormProjects/Logo Rally ?? (for example: "logo rally" --> "Logo Rally")
I accepted the mapping and the breakpoint doesn't work within the module file. It doesn't work anywhere else but having a breakpoint in the index.php file works which is only about 10 lines of code so it doesn't help much. I never renamed the folder.
I appreciate the help I've been trying to get this working since last night!
:(
OK .. breakpoint in another file does not work.
1) What kind of line it is? A screenshot please. Thing is -- xdebug cannot stop on certain breakpoints (e.g multiline statements or other weird things)
2) Will it work if you invoke breakpoint manually (e.g. by placing xdebug_break(); line in such file) ?
3) Does IDE able to step in into that file (e.g. breakpoint is hit in index.php .. and then you proceed line by line and step into other files) ?
4) That "module file" -- what is the full path on the remote server (resolved path, in case of symlinks) ?
5) If nothing -- please collect some detailed logs:
I put a breakpoint at a initialization of an array just to see if things work.
I also tried putting in xdebug_break and it's not causing any errors or a break for that matter.
Attachment(s):
Screen Shot 2013-06-19 at 2.40.50 PM.png
So .. what about other points?
The breakpoint icon (in this module file) -- how does it look when you debug index.php? Does it look like plain red circle .. or is it like in index.php (red circle with a tick inside)?
If second (with the tick) -- breakpoint is successfully registered and it should work; if not -- most likely path mapping issue (or MacOS-specific "nuance" (remember, I've asked if you renamed any of such folders -- there is a nuance about that and PhpStorm does not play well in such case)) -- logs are definitely required here as only they can tell what paths got used by both sides.
Suggestion/idea:
Request that module DIRECTLY (e.g. http://192.168.0.37/drupal/path/to/the/logo_management.module (or better -- any other .php file in that folder -- add some with .php extension and request it) ).
The reason -- maybe (just maybe) the path on the server will be quite different to what you are expecting it to be.
I just wanted to say thank you for all of the help that you have provided. Everything is working fine now, and it wasn't anything to do with phpstorm. :_| Drupal's cache needed refreshing in order for hooks to work.
In the end I appreciate all of the help you gave me and now it's time to code with phpstorm!