简体   繁体   English

为什么 Xdebug 3 profiler 在 CLI 中触发而不在 Apache 中触发?

[英]Why Xdebug 3 profiler triggers in CLI but not in Apache?

I can trigger a PHP debug session (for both CLI and Apache) but when trying to profile it is working ONLY when in CLI mode and not under Apache2.我可以触发 PHP 调试会话(对于 CLI 和 Apache),但是在尝试分析时,它仅在 CLI 模式下而不是在 Apache2 下工作。

Here is my Xdebug configuration (xdebug.ini):这是我的 Xdebug 配置(xdebug.ini):

zend_extension=xdebug.so

xdebug.remote_handler=dbgp;
xdebug.mode=debug,profile;
xdebug.start_with_request=yes
xdebug.client_host=127.0.0.1;
xdebug.client_port=9003;
xdebug.discover_client_host = 1;
#xdebug.log_level=0;

#problems about xdebug profile itself
xdebug.log="/tmp/xdebugprofile/xdebug.log"

xdebug.output_dir = "/tmp/xdebugprofile";
xdebug.profiler_output_name = "cachegrind.out.%u.%H_%R";

Any idea of such inconsistent behavior?对这种不一致的行为有任何想法吗?

(Linux Mint 20, PHP 8.0, Apache2) (Linux Mint 20、PHP 8.0、Apache2)

I had the same problem.我有同样的问题。 The solution was following:解决方案如下:

In the service unit file the variable PrivateTmp was set to true:在服务单元文件中,变量 PrivateTmp 设置为 true:

 PrivateTmp=true

I set the above to false and then restarted php-fpm我将上述设置为 false,然后重新启动 php-fpm

Possible locations of the file:文件的可能位置:

/usr/lib/systemd/system/php-fpm.service /usr/lib/systemd/system/php-fpm.service

/usr/lib/systemd/system/php72-php-fpm.service /usr/lib/systemd/system/php72-php-fpm.service

You might find it using:您可能会发现它使用:

sudo find /usr/ -name php-fpm.service sudo find /usr/ -name php-fpm.service

Now cachegrind files were created in /tmp现在 cachegrind 文件是在 /tmp 中创建的

Solution taken from: xdebug only profile php process not php-fpm process解决方案取自: xdebug only profile php process not php-fpm process

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

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