如何解决使用 Xdebug 连接 nginx
我想在我的 web 项目中使用 Xdebug 我做配置,当我运行这个
php -S localhost:88 ./index.php
一切正常,Xdebug 正常工作并在断点处停止
但是当我想用 nginx 加载页面时,我遇到了问题
页面加载和我的断点不会停止页面加载
我把我的配置放在这里
launch.json
{
"version": "0.2.0","configurations": [
{
"name": "Listen for XDebug","type": "php","request": "launch","port": 9004,"stopOnEntry":true,"log": true
},{
"name": "Launch currently open script","program": "${file}","cwd": "${fileDirname}","port": 9004
}
]
}
nginx
server {
listen 80;
listen [::]:80;
root /home/azibom/Desktop/cyphy/cypht-master/site;
index index.php index.html index.htm index.nginx-debian.html;
server_name localhost;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location ~ /\.ht {
deny all;
}
}
php.ini
[xdebug]
zend_extension=/usr/lib/php/20190902/xdebug.so
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9004
当我运行这个脚本时
<?php
xdebug_info();
我在浏览器中收到 500 错误
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com(将#修改为@)