Cannot find file locally. Set environment variable PHP_IDE_CONFIG

When doing PHPUnit tests, I encountered a problem while "stepping into" my controller function call. This problem occurrs only when debugging PHPUnit tests. When debugging the regular application, there is no problem with stepping into this function.

In the debug "Variables" tab, this message appears in red:
Cannot find file '/2' locally. To fix it set server name by environment variable PHP_IDE_CONFIG and restart debug session.

So I exited PHPStorm, set the environment variable in Windows and launched PHPStorm again, but the error is still there. (typing "set" in the Terminal panel shows PHP_IDE_CONFIG=serverName=localhost). So it didn't help.

It's strange because the method I want to step into is defined in a class in a file that is in the same directory that the method currently being debugged. Also, in the editor, pressing Ctrl-B on the method name opens the file with the method definition. So editor can find the method, but debugger can't.

How to deal with this problem?

4 comments

Hi there,

Collect xdebug log -- you are doing PHPUnit which may do some extra stuff (e.g. runtime only files etc). The log should reveal what file xdebug is trying to step in etc.

0

I've added these settings to php.ini:

xdebug.remote_log="c:\temp\xdebug\xdebug.log"
xdebug.remote_autostart = 1

But the log does not exist, is not created.

I also turned on debug logs as described here: https://intellij-support.jetbrains.com/hc/en-us/articles/207241115-How-to-Collecting-PhpStorm-WebStorm-debug-Logs

And the idea.log contains these lines which I believe correspond to the moment when I debug Respond function in Respond.php file and try to "step into" the Log function which is in Log.php file, but nothing specific:

2016-04-13 14:28:13,137 [  79731]  DEBUG - p.debug.common.PhpDebugProcess - 1144911# remote: 'file:///I:/xampp/htdocs/apps/laravel/nu/app/Gfl/Responder.php' <-> extracted: 'I:\xampp\htdocs\apps\laravel\nu\app\Gfl\Responder.php' 
2016-04-13 14:28:15,337 [  81931]  DEBUG - p.debug.common.PhpDebugProcess - 1144911# Stop at ('dbgp://2':764)
2016-04-13 14:28:15,338 [  81932]  DEBUG - p.debug.common.PhpDebugProcess - 1144911# remote: 'dbgp://2' <-> local: '2'
2016-04-13 14:28:15,338 [  81932]  DEBUG - p.debug.common.PhpDebugProcess - 1144911# remote: 'dbgp://2' <-> extracted: '/2'
2016-04-13 14:28:18,347 [  84941]  DEBUG - p.debug.common.PhpDebugProcess - 1144911# Stop at ('file:///I:/xampp/htdocs/apps/laravel/nu/app/Gfl/Responder.php':69)

Anything else I can do to identify the source of the problem?

 

0

Sorry, I have no clue what "dbgp://2" means here. It is actual DBGp protocol that is used between xdebug and IDE .. but I have no clue about what this particular one does.

My suggestion -- provide some reproducible case (a sample project), collect all logs (xdebug log is important here, so try capturing it somehow) and submit a ticket to the actual Issue Tracker

0

Sorry, my bad. I forgot that earlier in the test I made a mock for the function I wanted to "step into". So obviously it shouldn't be debugged.

0

Please sign in to leave a comment.