php - xdebug 仅配置 php 进程而不是 php-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 进程都可以触发 prifiling,而 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 配置
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;
}
解决方案
PrivateTmp=true
我认为您在服务单元文件中受到影响:
/usr/lib/systemd/system/php72-php-fpm.service
默认情况下,XDebug 将分析器文件存储在xdebug.profiler_output_dir=/tmp
您可以禁用PrivateTmp
或使用外部目录/tmp
或/var/tmp
推荐阅读
- bash - 为什么树结构的 Rsync 会在 Raspberry Pi 上破坏根文件系统?
- python - 尽管有值,python 0 分配器不返回任何值
- flutter - 如何在 Riverpod 中进行 http.post 调用?
- r - 如何使用包括从列和行移动的模式在#R 中的数据框中搜索和提取?
- c# - msbuild.exe 创建的 bin/fr 文件夹的用途是什么?
- python - 使用python单击某个进程的像素
- amazon-web-services - AWS 中秘密轮换的输出
- laravel - Laravel 会话丢失或未在重定向时创建
- angular - 错误的数据来自 Angular 10 中的 Observable 服务
- mapbox-gl-js - 如何添加与mapbox集成的I3SLoader 3dtile层(deck.gl)