gpt4 book ai didi

php - Nginx - 在 stderr : "PHP message: PHP Notice: Undefined variable 中发送的 FastCGI

转载 作者:可可西里 更新时间:2023-11-01 13:25:57 28 4
gpt4 key购买 nike

我已经安装了 Ngnix 服务器并配置如下:

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /usr/share/nginx/html;
index index.php index.html index.htm;

# Make site accessible from http://localhost/
server_name localhost;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}

# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
# proxy_pass http://127.0.0.1:8080;
#}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = / {
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}

我收到这些错误(从我的 error.log 中复制):

    *9 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined variable: confMsg in /usr/share/nginx/html/admin-interface/login.php on line 196" while reading upstream, client: 127.0.0.1, server: localhost, request: "GET /admin-interface/login.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "localhost"

2015/12/16 00:27:37 [error] 952#0: *9 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: username in /usr/share/nginx/html/admin-interface/login.php on line 245 PHP message: PHP Notice: Undefined index: username in /usr/share/nginx/html/admin-interface/login.php on line 249" while reading upstream, client: 127.0.0.1, server: localhost, request: "GET /admin-interface/login.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "localhost"

我正在尝试使用 Ngnix 服务器配置此环境,此环境确实可以使用不同的主机。我确实在我的 php.ini 中更改了 cgi.fix_pathinfo = 0

我的配置缺少什么?

最佳答案

这不是错误,而是通知

脚本 /usr/share/nginx/html/admin-interface/login.php 正在访问当时不存在的变量 $confMsg

您可以在 php.ini 中更改错误报告级别(这也会影响其他脚本并且您不想关闭通知..)或修复错误的变量访问脚本。

第二种解决方案会更简单,因为您只需初始化 $confMsg = '';

关于php - Nginx - 在 stderr : "PHP message: PHP Notice: Undefined variable 中发送的 FastCGI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34301099/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com