3
votes

I'm trying to set up xdebug debugger with phpstorm. I'm running xampp on windows 7. Xdebug section in php.ini:

[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug-2.2.5-5.5-vc11.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.idekey = "PHPSTORM"
xdebug.remote_port = 10000
xdebug.trace_output_dir = "C:\xampp\tmp"

In phpstorm I've checked this:

IDE found php and xdebug

Also, I've set appropriate port:

enter image description here

After that I've:

  1. Created bookkmark to start debugger(generated on jetbrain's page) with appropriate IDE key(PHPSTORM);

  2. Used special extension for Google Chrome, which also set cookies for this:

enter image description here

And finally, I've even disabled my firewall(before this I tried to add rule, but this didn't helped).

What I wrote here, didn't helped me to catch the breakpoint. I clicked on the "phone button" inside IDE, this also didn't helped. And, I want to emphasize, that incoming request from Xdebug also didn't came on first use.

Also, I want to mention that only index.php debugging works. Any controller/action doesn't, but only index.php do.

In phpinfo() xdebug is also present:

enter image description here

4
You have xdebug.remote_autostart = 1 -- no need for any bookmarklets or similar. I suggest to delete any entries in Settings | PHP | Servers and start again (the zero-config approach: confluence.jetbrains.com/display/PhpStorm/…). Right now it's hard to say what is wrong -- possibly you need to specify proper path mappings for debugging if symbolic links or similar is in use somewhere in the path (remember: xdebug only works with final/resolved paths) - LazyOne
Other thing to try: place xdebug_break(); in a file where normal breakpoint does not work (obviously, not on the same line where that breakpoint is set) -- any difference? Also -- what kind of those lines with breakpoints are: xdebug can not always break on certain lines (e.g. some multi-line statements etc). If still nothing -- enable xdebug logging and see what it says: xdebug.remote_log - LazyOne
Also -- your screenshot with port number: if you disable both Force break... options -- will it break at all? If not -- then you have wrong path mappings for sure (or file is outside of the project). - LazyOne
1. I've done that, there is no any difference. 2. Catched breakpoint with xdebug_break();, but there is problem(see link) c2n.me/ja0etr But where is the problem? Path 1 is correct, and for what text box 2 there? 3. If I disable, there is no any difference. You are right, I have troubles with mappings... - Grokking
BTW: #1 path should usually be applied to the project root: all subfolders will inherit it as a base; then you may adjust it for sub folders if necessary. Since I do not see your full paths ... I may only think that 1) you do not have path mapping for whole project/root .. and 2) that file (controller) is not located in your public folder and it does not have the mapping. Once again: for local projects (where server and IDE is on the same computer) no path mappings usually required. If required then it means that symlink/mapped drive is in use somewhere in the path. - LazyOne

4 Answers

3
votes

See this: Map one directory path to another in PHPStorm

In Settings -> PHP -> Server, map all the folders you need to debug files in.

1
votes

I resolved this by manually mapping each path in project from remote to local paths

In my case phpstorm (windows) + yii2/xdebug (linux on vmbox)

c:\phpstormprojects\yii\models -> /home/yii/apps/yii/models

etc

0
votes

IMPORTANT: Make sure you are using the LATEST version of PHPStorm! Older versions of PHPStorm will not work with newer versions of XDebug. A common error you'll run into is breakpoints only working on index.php and not being able to step over or into code.

Finally, make sure the version of XDebug you're using is compatible with the version of PHP you're running. For instance, PHP 7.3 and 7.4 use XDebug 2.9.

90% of the time people have problems with XDebug because the port they're trying to use is busy, or they're the version they're using isn't compatible with the IDE or the version of PHP that's being used.

0
votes

Hey I was having the same problem after a bit of struggling with this problem I have found that the problem is with my xdebug version. I was using wrong xdebug version. So after rectifying my error I have following Setup:

  1. Xdebug File Version

php_xdebug-2.7.0alpha1-7.2-vc15.dll

  1. Phpstorm Version

2017.1.4

  1. php.ini file
zend_extension = F:\xampp\php\ext\php_xdebug-2.7.0alpha1-7.2-vc15.dll
xdebug.remote_autostart = 1
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "F:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_log = "F:\xampp\tmp\xdebug.txt"
xdebug.remote_port = 9000
xdebug.trace_output_dir = "F:\xampp\tmp"
xdebug.remote_cookie_expire_time = 36000
xdebug.idekey= "PHPSTORM"

NOTE:- Add above lines at the end of php.ini file and User Your PC's Drive path in which XAMPP is installed

  1. xampp version

3.2.2