简体   繁体   English

XDebug,如何禁用单个 .php 文件的远程调试?

[英]XDebug, how to disable remote debugging for single .php file?

I'm using Eclipse IDE + remote Xdebug.我正在使用 Eclipse IDE + 远程 Xdebug。 EclipseIDE is listening 9000 port for some kind of Xdebug information. EclipseIDE 正在侦听 9000 端口以获取某种 Xdebug 信息。

There are some php scripts running by cron on server.服务器上有一些由 cron 运行的 php 脚本。 So, every cron execution xdebug is sending information to my workstation and EclipseIDE is trying to find this file in my project.因此,每个 cron 执行 xdebug 都在向我的工作站发送信息,而 EclipseIDE 正在尝试在我的项目中找到这个文件。 But file couldn't be find because cron running scrits do not relate to the project I'm working with.但是找不到文件,因为运行 scrits 的 cron 与我正在使用的项目无关。 So, every cron run Eclipse IDE is alerting this message http://img2.pict.com/22/fc/86/3299517/0/screenshot2b142.png因此,每次运行 Eclipse IDE 的 cron 都会提醒此消息http://img2.pict.com/22/fc/86/3299517/0/screenshot2b142.png

I've tried to add to cron executed php scripts some strings...我试图将一些字符串添加到 cron 执行的 php 脚本中...

if (function_exists('xdebug_disable')) {
  xdebug_disable();
}

... but it didn't helped. ......但它没有帮助。

Any ideas?有任何想法吗?

Thank you谢谢

As I've investigated I should set xdebug.remote_autostart=0 See documentation: http://xdebug.org/docs/remote正如我所调查的,我应该设置xdebug.remote_autostart=0请参阅文档: http : //xdebug.org/docs/remote

Important!重要的! You should change this value through php.ini.您应该通过 php.ini 更改此值。 Using function ini_set('xdebug.remote_autostart', 0) won't work because sesion has already started and you'll be still getting xdebug information to your remote host.使用函数 ini_set('xdebug.remote_autostart', 0) 将不起作用,因为会话已经开始并且您仍将向远程主机获取 xdebug 信息。

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

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