XDebug PHP Eclipse - Error Missing Corresponding File or File Not Selected

I'm trying to debug a php web application remotely, but anytime I try to start a debugging session, Eclipse floods me with a bunch of pop-ups:

Debugger error: "The desired file was not selected or the file was not selected. Debugging completed . "

enter image description here

This is my current Xdebug 2.2.1 configuration:

[xdebug] xdebug.remote_enable=1 xdebug.remote_autostart=0 xdebug.remote_host="localhost" xdebug.remote_port=9000 xdebug.remote_handler="dbgp" 

This is my Eclipse 4.2.1 debug configuration:

enter image description here

Xdebug is installed correctly, I see it included in phpinfo () output.

+8
php web-applications xdebug macos eclipse-pdt
source share
5 answers

I tried debugging Eclipse to understand what was going on in my Mac OS X.
First find the currently running Eclipse process:

 $ ps -ef | grep eclipse 501 15160 373 0 4:21PM ?? 2:57.19 /Users/myuser/apps/eclipse/Eclipse.app/Contents/MacOS/eclipse -psn_0_651423 

Then trace the Eclipse system calls:

 $ sudo dtruss -fp 15160 [... omissis ...] accept(0xA0, 0x1224C37E8, 0x1224C37E4) = 103 0 setsockopt(0x67, 0xFFFF, 0x1002) = 0 0 setsockopt(0x67, 0xFFFF, 0x1001) = 0 0 read(0x67, "4\0", 0x1) = 1 0 read(0x67, "7\0", 0x1) = 1 0 read(0x67, "7\0", 0x1) = 1 0 read(0x67, "\0", 0x1) = 1 0 read(0x67, "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<init xmlns=\"urn:debugger_protocol_v1\" xmlns:xdebug=\"http://xdebug.org/dbgp/xdebug\" fileuri=\"file:///opt/local/var/db/php5/pear/pear-ini.php\" language=\"PHP\" protocol_version=\"1.0\" appid=\"14961\" idekey=\"ECLIPSE_DB", 0x1DD) = 477 0 read(0x67, "\0", 0x1) = 1 0 [... omissis ...] 

Here I caught the first line sent from xdebug.
This is the line where eclipse reads the XML fragment. I suppose this is part of DBGp.

  <?xml version="1.0" encoding="iso-8859-1"?> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///opt/local/var/db/php5/pear/pear-ini.php" language="PHP" protocol_version="1.0" appid="14961" idekey="ECLIPSE_DB 

Looking at fileuri I found that Xdebug is trying to start a debugging session using /opt/local/var/db/php5/pear/pear-ini.php . The pear-ini.php does not exist in my Eclipse projects.

So I create a new project in my Eclipse workspace, and here I copied the file /opt/local/var/db/php5/pear/pear-ini.php

This works, the Eclipse PDT now finds the file that it was looking for, and the debugger finally starts correctly. He even asks me if I want to switch to the debugging perspective.

Conclusion
If you come across this strange error: "The corresponding file was not found or the file was not selected." This means what is written. Well, my Eclipse could not find the file, but it also meant that it was trying to find a file that was outside its workspace. There may be a file that is being downloaded from the PHP engine for some strange reason. In my case, pear-ini.php added automatically using pear.ini

 $ cat pear.ini ; Do not edit this file; it is automatically generated by MacPorts. ; Any changes you make will be lost if you upgrade or uninstall php5-pear. ; To configure PHP, edit /opt/local/etc/php5/php.ini. auto_prepend_file = '/opt/local/var/db/php5/pear/pear-ini.php' 
+7
source share

I had the same problem, and although the freedev answer pointed me in the right direction, it really didn't solve it.

Using dtruss did not help: I ​​did not see this XML <init> element anywhere. But I was able to find it as soon as I set xdebug.remote_log=/tmp/xdebug.log to php.ini and then processed the /tmp/xdebug.log file when I tried to start a remote debugging session. Once again mentioned /opt/local/var/db/php5/pear/pear-ini.php . But I have this file in my file system, so I have no idea why I still get this vague message about the missing file.

However, now that I knew that Pear was involved in the problem, I tried just uninstalling Pear ( sudo port uninstall php53-pear ) since I no longer used it. And now, here it is fixed! I no longer receive the "No matching file" error message, and I can debug as usual.

When removing php53-pear, the fileuri parameter in the XML data is now the index.php file for the Drupal site I was trying to debug. So I think you should expect the entry point file for your web requests to appear in this XML <init> element. I wish I knew why Pear set changes to this fileuri attribute. The ability to configure Pear to stop messing with Xdebug will be much better than removing Pear.

+3
source share

I met the same problem and the reason was not pear.ini or pear-ini.php as above.

The reason was so simple. I installed both PDT and Aptana PHP Plugin in an Eclipse environment. Simply , switching both the project type and the debug configuration type to PDT, everything worked fine.

Thank you for reporting a good topic. :)

+1
source share

I use Linux and bind the Eclipse process using strace (a real Java subprocess, of course), I could not catch such errors.

For those who are experiencing the same problem, but not suitable for solving the problem, and if you recently did an Eclipse or PDT upgrade, try deleting the project and re-creating it. He solved my problem when xdebug debugging and Eclipse project cleanup were not performed.

0
source share

If your debugger worked, but then it started throwing this message, you may have just noted a source file that Eclipse does not see in it as part of the project or cannot find it at all.

For example, when I was debugging a plugin that I wrote for Wordpress, I bookmarked some external Wordpress file that seems like Eclipse / Xdebug cannot access / find. As soon as I delete this bookmark, everything returns to normal.

If this is the case, just delete all the bookmarks.

0
source share

All Articles