1.php.ini 把cgi.fix_pathinfo=0 改为 cgi.fix_pathinfo=1
2.nginx.conf配置
(1). 在include enable-php.conf 前边加上#,引入 enable-php-pathinfo
#include enable-php.conf;
include enable-php-pathinfo.conf;
(2) server 加入
location ~ [^/]\.php(/|$)
{#try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
include pathinfo.conf;
}
location ~ [^/]\.html(/|$)
{
#try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
include pathinfo.conf;
}
修复PHP路径信息配置
本文介绍如何通过修改php.ini和nginx.conf文件来正确配置PHP的路径信息,包括设置cgi.fix_pathinfo参数及调整Nginx的location匹配规则,确保PHP文件能够被正确解析。
2759

被折叠的 条评论
为什么被折叠?



