php - 用 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",
"type": "php",
"request": "launch",
"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 错误
解决方案
推荐阅读
- javascript - 如何在javascript中按单词序列匹配两个字符串?
- flutter - Flutter:如何在没有小部件的情况下跟踪应用程序生命周期
- javascript - 隐藏特定用户角色 Wordpress 的类 CSS
- python - Sublime Text 不能与 Anaconda 一起编译
- javascript - 第一次在JS中使用API;需要一些数组和页面加载指导
- meteor - Meteor Semantic UI react: 修改用户账户信息
- android-studio - 有没有办法使用 Android Studio 调试 cordova 应用程序并在不同版本的 Android 上进行测试?
- django - 我需要做些什么来加载静态
- javascript - 为什么在使用 Ajax 调用同时传递变量的 URL 时我的一些 CSS 格式丢失
- node.js - 使用 express/mongoose 将先前的对象数组替换为新的对象数组