How can i get the PHP magic constant __FILE__ work with Eclipse and PDT

后端 未结 5 1014
刺人心
刺人心 2021-02-20 04:23

Lately when i was debugging some PHP file with XDebug (under Eclipse on Ubuntu) i came across a strange behaviour:

print(__FILE__);

resulted in

5条回答
  •  终归单人心
    2021-02-20 04:46

    Despite this is quite old topic, but it is still actual. That's why I'm going to copy-paste my answer from the similar topic here as well.

    This is XDEBUG issue, which can be fixed by downgrading (or upgrading in case you work with very old PHP) of XDEBUG version to 2.6.1. I accidentally faced this issue and wasn't able to find an answer. Reinstall of server, PHP, PHPStorm, different versions of XDEBUG didn't help. For MacOS one can use

    pecl install xdebug-2.6.1

    In case you already have newer version you can use command

    pecl uninstall xdebug

    Answers in this article helped me a lot after several hours of investigation.

提交回复
热议问题