简体   繁体   English

如何在 Apache 中启用 XDebug 而不是在 CLI 中?

[英]How to enable XDebug in Apache but not in CLI?

I want to enable the XDebug module in PHP as run by Apache, but not for the CLI php command.我想在由 Apache 运行的 PHP 中启用 XDebug 模块,但不是为 CLI php命令启用。 I'm on Mac and I have Apache (httpd) and PHP 7.3 installed with Homebrew.我在 Mac 上,我安装了 Homebrew 的 Apache (httpd) 和 PHP 7.3。

PHP runs much slower with XDebug enabled, even when I'm not debugging a given php command. PHP 在启用 XDebug 的情况下运行速度要慢得多,即使我没有调试给定的php命令。

There are separate php.ini for CLI and Apache. CLI 和 Apache 有单独的 php.ini。 In /etc/php/7.3/ there is an apache2 and cli directory./etc/php/7.3/有一个apache2cli目录。 For enabling Xdebug in 'apache2/php.ini' add these lines:要在 'apache2/php.ini' 中启用 Xdebug,请添加以下几行:

xdebug.remote_autostart=1  
xdebug.remote_enable=1

And for Xdebug's profiler:对于 Xdebug 的分析器:

xdebug.profiler_enable=1

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

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