Have tried for quite some time to get this to work correctly but to no luck. Basically, I have Eclipse (3.3) with PHP Development Tools (PDT), and the PDT XDebug plugin as well as the SimpleTest eclipse plugin.
我已经尝试了很长一段时间让它正确地工作,但没有运气。基本上,我有Eclipse(3.3)和PHP开发工具(PDT)、PDT XDebug插件以及SimpleTest Eclipse插件。
What I want to do is debug code invoked by SimpleTest unit tests. SimpleTest clearly can see XDebug, because I can generate code coverage reports, but it just won't stop on breakpoints.
我想做的是调试由SimpleTest单元测试调用的代码。SimpleTest可以清楚地看到XDebug,因为我可以生成代码覆盖率报告,但是它不会停留在断点上。
Edit: Should add that XDebug and breakpoints work fine in eclipse, just not when invoked by SimpleTest
编辑:应该添加XDebug和断点在eclipse中工作得很好,只是在SimpleTest调用时不能
Has anyone set this up successfully? There's a lot of guff docs around and little in the way of useful information.
有人成功设置过吗?现在有很多废话连篇的文档,却很少有有用的信息。
Thanks!
谢谢!
2 个解决方案
#1
3
Make sure you have the right XDebug version for your version of PHP and add this at the very beginning of your php.ini file:
确保在PHP版本中有正确的XDebug版本,并在PHP的开头添加这个版本。ini文件:
[xdebug]
zend_extension=full_path_to_your_xdebug.so
xdebug.default_enable=On
xdebug.remote_enable=On
xdebug.remote_handler="dbgp"
xdebug.remote_host="localhost"
xdebug.remote_port=9000
Then do an apachectl graceful
and a phpinfo
and make sure XDebug is present and active. If it is, everything should work fine. I know it does for me.
然后做一个优雅的apachectl和phpinfo,并确保XDebug在。如果是这样的话,一切都会很好。我知道这对我有好处。
edit: I answered before reading the entire question.
编辑:我在阅读整个问题之前回答了。
before running the script you should set the environment variable;
在运行脚本之前,应该设置环境变量;
export XDEBUG_CONFIG="idekey=session_name"
It might be possible to do this from php but i cannot test this:
从php中可以做到这一点,但我不能测试这个:
putenv('XDEBUG_CONFIG="idekey=session_name"');
You should make sure that the php binary you are using has the XDebug extension loaded, on my system the apache module has it, but the default CLI interpreter does not, but I run different versions on purpose.
您应该确保正在使用的php二进制文件已经加载了XDebug扩展,在我的系统上,apache模块已经加载了它,但是默认的CLI解释器没有,但是我故意运行不同的版本。
There's some good documentation here
这里有一些很好的文档
#2
0
To go further on Kris' answer, If you manage your production and development environments on the same Server, It's a good idea to relegate your xdebug settings either to a php include
or to those of your virtualhosts
which are dedicated to dev
or testing
environments :
要进一步了解Kris的答案,如果您在同一台服务器上管理您的生产和开发环境,那么将xdebug设置降级为php或您的virtualhosts(专门用于开发或测试环境)是一个好主意:
-
the syntax for virtualhosts is
虚拟主机的语法是
<virtualHost ....> (...) # Xdebug ENV php_flag xdebug.auto_trace on php_flag xdebug.idekey session_name php_flag xdebug.profiler_enable_trigger 1 php_flag xdebug.(...) (...)
#1
3
Make sure you have the right XDebug version for your version of PHP and add this at the very beginning of your php.ini file:
确保在PHP版本中有正确的XDebug版本,并在PHP的开头添加这个版本。ini文件:
[xdebug]
zend_extension=full_path_to_your_xdebug.so
xdebug.default_enable=On
xdebug.remote_enable=On
xdebug.remote_handler="dbgp"
xdebug.remote_host="localhost"
xdebug.remote_port=9000
Then do an apachectl graceful
and a phpinfo
and make sure XDebug is present and active. If it is, everything should work fine. I know it does for me.
然后做一个优雅的apachectl和phpinfo,并确保XDebug在。如果是这样的话,一切都会很好。我知道这对我有好处。
edit: I answered before reading the entire question.
编辑:我在阅读整个问题之前回答了。
before running the script you should set the environment variable;
在运行脚本之前,应该设置环境变量;
export XDEBUG_CONFIG="idekey=session_name"
It might be possible to do this from php but i cannot test this:
从php中可以做到这一点,但我不能测试这个:
putenv('XDEBUG_CONFIG="idekey=session_name"');
You should make sure that the php binary you are using has the XDebug extension loaded, on my system the apache module has it, but the default CLI interpreter does not, but I run different versions on purpose.
您应该确保正在使用的php二进制文件已经加载了XDebug扩展,在我的系统上,apache模块已经加载了它,但是默认的CLI解释器没有,但是我故意运行不同的版本。
There's some good documentation here
这里有一些很好的文档
#2
0
To go further on Kris' answer, If you manage your production and development environments on the same Server, It's a good idea to relegate your xdebug settings either to a php include
or to those of your virtualhosts
which are dedicated to dev
or testing
environments :
要进一步了解Kris的答案,如果您在同一台服务器上管理您的生产和开发环境,那么将xdebug设置降级为php或您的virtualhosts(专门用于开发或测试环境)是一个好主意:
-
the syntax for virtualhosts is
虚拟主机的语法是
<virtualHost ....> (...) # Xdebug ENV php_flag xdebug.auto_trace on php_flag xdebug.idekey session_name php_flag xdebug.profiler_enable_trigger 1 php_flag xdebug.(...) (...)