PHPStorm Debugging.
I have project settings that indicate I have a PHP interpreter with XDebug 2.2.3 installed and enabled (as reported by PHPStorm). I have the Chrome extension (XDebug Helper 1.4.2) that I have enabled (the bug is green). I have clicked on the icon to listen for PHP debug connections on the IDE. Yet when I set a breakpoint it never gets hit.When I build a small sample program debugging works just fine but with a larger set of source code (of which the "project" is a small subset) I cannot get any breakpoints to be hit. Ideas?
请先登录再写评论。
Hi there,
1) What kind of line is it? Xdebug is unable to break on certain lines (due to the way how PHP generates bytecode).
2) Does it work if you put xdebug_break(); into your code there?
3) Is your breakpoint is registered? Does icon has a "tick" on it?
4) Do you have any symbolic links in the path where that file is located? If used -- proper path mappings must be set (Settings | PHP | Servers) since xdebug works with resolved/real paths ONLY.
5) Is your file is actually inside the project ?
6) Enable logging from both sides (see below) and see if breakpoint is registered .. and if hit how PhpStorm reacts to it:
I have attached the logs. xdebug_break() doesn't break but I can put an echo statement in its place and I see the echo output so I know the code is being executed. For PHPStorm I seem to get a bunch of
cant register breakpoint. No path mapping for local path '{0}'
errors in the output. I don't understand the message or how to fix it. For the xdebug log (which is admittedly long) I could not zero in on any errors.
This is at least something to look at. Thank you.
Attachment(s):
xdebug.log.zip
idea.log.zip
Never seen such message, TBH. The '{0}' part is confusing to me.
Can you please show screenshot of your "Settings | PHP | Servers" (with all path mappings visible, if any of course)?
Based on xdebug log I do see that it actually breaks (e.g. from last session: "C:/wamp/apps/moodle26/index.php" on line 26), but that's about it.
Also, what's your PHP version?
I am using Apache version 2.4.7 and PHP version 5.5.7. Akibg with the PHP server screen-shot I have also included the output from phpinfo.
Thanks again.
Attachment(s):
phpinfo.htm.zip
PHPServer.jpg
Few possible things:
1) Please try disabling opcache extension and restart Apache. They actually should work together OK (and you have said that simple site debugs just fine), but some people reported that they had issues while debugging with opcache enabled so it worth checking this out.
2) You have "Use path mappings" option checked but no mappings actually provided. Uncheck that option.
3) Your project root seems to be C:\wamp\apps\moodle26\mod\mediasite\ while xdebug tries to break (based on the xdebug log) on C:\wamp\apps\moodle26\index.php, which is OUTSIDE of the project hence it cannot break there (unless you have included it there somehow).
If this file is NOT important (you do not want to break there .. or it is from different site etc), then consider disabling "Force break at the first line..." options at "Settings | PHP | Debug"
I tried all of the suggestions. It worked! Then for my own info enabled opcache and it still worked. So it seems the solution for me was 2). Thank you.