简体   繁体   English

Eclipse中的xdebug:限制调试哪些路径

[英]xdebug with Eclipse: restrict which paths are debugged

I am using xdebug under Eclipse to develop a PHP program. 我正在Eclipse下使用xdebug开发PHP程序。 The problem is that every php page fetched from localhost triggers the debugger: My own program, even when I fetch it directly from the browser, but also phpmyadmin , the MAMP admin page, etc. It's a pain. 问题在于,从本地主机获取的每个 php页面都会触发调试器:即使是直接从浏览器获取的我自己的程序,也可能是phpmyadmin ,MAMP admin页面等。这很痛苦。

How do I get Xdebug to only start up when I launch a script with the "Debug" button in eclipse, or at least to only start for pages in a subtree below my document root (eg, localhost:8888/myapp/... )? 如何使Xdebug仅在使用Eclipse中的“调试”按钮启动脚本时才能启动,或者至少仅在文档根目录下的子树中启动(例如, localhost:8888/myapp/... )?

In order to get breakpoints to work, I had to enable "remote debugging". 为了使断点正常工作,我必须启用“远程调试”。 I have remote debugging set to "ask", but that's still unacceptably clunky-- and an application like phpmyadmin fetches several php scripts to load a page. 我将远程调试设置为“询问”,但这仍然令人难以接受,而且像phpmyadmin这样的应用程序会获取多个php脚本来加载页面。

My web server is MAMP on OS X, if that makes a difference. 我的Web服务器是OS X上的MAMP,如果有区别的话。

XDebug enable debugging based on it's own cookie, and you cannot set cookie path. XDebug基于它自己的cookie启用调试,并且您不能设置cookie路径。 You have couple ways to stop debug: 您有几种停止调试的方法:

  1. Stop it in eclipse, and rerun later (anyway in current version stop session doesn't work, fixed in nightly : https://bugs.eclipse.org/bugs/show_bug.cgi?id=460836 ) 在eclipse中停止它,然后稍后重新运行(无论如何,在当前版本中,停止会话不起作用,已在每晚修正: https : //bugs.eclipse.org/bugs/show_bug.cgi? id =460836

  2. Stop/start by chrome/fox plugin (its in general create/drop cookie) like https://addons.mozilla.org/en-us/firefox/addon/the-easiest-xdebug/ 通过chrome / fox插件(通常是创建/删除cookie)停止/启动,例如https://addons.mozilla.org/en-us/firefox/addon/the-easiest-xdebug/

  3. Use different hostnames/ips for same vhost. 对同一虚拟主机使用不同的主机名/ IP。 For example 127.0.0.1 for phpmyadmin, and localhost for your scripts. 例如,phpmyadmin为127.0.0.1,脚本为localhost。

  4. Use different php instance (on wamp will be hard ;)) 使用不同的php实例(在wamp上很难;))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM