donqo88682 2015-12-15 23:02
浏览 624
已采纳

Nginx - 在stderr中发送的FastCGI:“PHP消息:PHP注意:未定义的变量

I've installed an Ngnix server and configured it like:

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;
    #}

}

I'm getting these errors (copied from my 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"

I'm trying to configure this environment using an Ngnix server, this environment does work using different hosting. I did change the cgi.fix_pathinfo = 0 in my php.ini

What am i missing with my configuration?

  • 写回答

2条回答 默认 最新

  • donglvmang8638 2016-02-12 15:14
    关注

    It's not an error, it's a notice.

    The script /usr/share/nginx/html/admin-interface/login.php is accessing the variable $confMsg which does not exist at that point.

    You can either change the error reporting level in php.ini (which has impact on other scripts too and you don't want to turn off notices..) or fix the wrong variable access in the script.

    The second solution would be easier because you'd just had to initialize $confMsg = '';.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?