xdebug仅配置文件php进程,而不是php-fpm进程

时间:2019-07-11 07:05:02

标签: php debugging xdebug profile fpm

php info.php可以触发配置文件并将配置文件写入/tmp/cachegrind.out.*,就像

-rw-r--r-- 1 roofe www        344 Jul 11 12:04 /tmp/cachegrind.out.6723
-rw-r--r-- 1 root  root      7172 Jul 11 12:06 /tmp/cachegrind.out.6808
-rw-r--r-- 1 root  root      7178 Jul 11 12:06 /tmp/cachegrind.out.6819

http://example.com/info.php无法触发分析

这是php信息

which php
/usr/bin/php
ll /usr/bin/php
lrwxrwxrwx 1 root root 27 May 21 15:14 /usr/bin/php -> /etc/opt/remi/php73/bin/php

我还发现所有php进程都可以触发离心,而php-fpm则不能。 ps -aef | grep php

root       927   919  1 10:51 ?        00:00:50 /etc/opt/remi/php73/bin/php artisan horizon:supervisor ......
root       948   928  0 10:51 ?        00:00:17 /etc/opt/remi/php73/bin/php artisan horizon:work ........
root     28161     1  0 09:45 ?        00:00:00 php-fpm: master process (/etc/opt/remi/php73/etc/php-fpm.conf)
www      28162 28161  1 09:45 ?        00:01:32 php-fpm: pool www

php.ini

;[xdebug]
zend_extension=/etc/opt/remi/php73/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so
xdebug.remote_autostart = On
xdebug.remote_enable = On
xdebug.remote_host=localhost
xdebug.remote_handler=dbgp
xdebug.collect_vars = On
xdebug.collect_return = On
xdebug.collect_params = On
xdebug.profiler_enable= On
xdebug.idekey = PHPSTORM

和nginx conf

location  / {
    index   /../home/index.html;
    add_header  X-Location /;
    try_files $uri /index.php$is_args$args;
    fastcgi_pass   unix:/dev/shm/php73-fpm.sock;
    fastcgi_index   index.php;
    fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include fastcgi_params;
}

1 个答案:

答案 0 :(得分:3)

我认为您会受到服务单位文件中PrivateTmp=true的影响:

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

默认情况下,xdebug.profiler_output_dir=/tmp中的XDebug存储分析器文件

您可以禁用PrivateTmp或使用/tmp/var/tmp之外的目录