PHP头条
热点:

Nginx PHP 返回200,但是空白页


ngxin;php-fpm安装后,html静态页面没问题,但是phpinfo页面虽然返回200,但总是空白页

也没有任何报错,考虑应该是nginx已经将php页面转移给php处理了,所以问题应该在php的配置上,经过查找,发现需要在nginx中加入一句话
fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;

安装完nginx后默认的fastcgi_params配置文件中没有上面这句话。

在nginx.conf中的
        location ~ .php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
或者在fastcgi_params配置文件中加入
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;
fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;

然后重启nginx就可以显示出页面了。

www.phpzy.comtrue/php/4248.htmlTechArticleNginx PHP 返回200,但是空白页 ngxin;php-fpm安装后,html静态页面没问题,但是phpinfo页面虽然返回200,但总是空白页 也没有任何报错,考虑应该是nginx已经将php页面转移给php处理了,所以问...

相关文章

    暂无相关文章
相关频道:

PHP之友评论

今天推荐