您好,欢迎访问一九零五行业门户网

nginx php空白页 fastcgi_param_PHP教程

今天安装完nginx 后 发现html页面能正常浏览 但是php文件的页面打开后是一篇空白 看php-fpm日志 看nginx日志都没找到问题
上网搜索了半天终于解决了,在这做个记录备忘
网上的一种说法是缺少这么一句话在nginx的配置文件里
fastcgi_param script_filename $document_root$fastcgi_script_name;
这句话是干嘛的呢 其实他就是定义php中用到的服务器变量 也就是$_server
http://wiki.nginx.org/nginxhttpfcgimodule 这个网址下有这么一句话
this module allows nginx to interact with fastcgi processes and control what parameters are passed to the process。
其实也就是服务器像你的处理php的cgi传递过去他需要的一些参数,而至少要有下面的两个参数php才能执行起来
below is an example of the minimally necessary parameters for php:
fastcgi_param script_filename /home/www/scripts/php$fastcgi_script_name;
fastcgi_param query_string $query_string;
parameter script_filename is used by php for determining the name of script to execute, and query_string contains the parameters of the request.
所以 我们在没有定义script_filename这个系统变量的时候 php是没法解释执行的
这个变量的定义可以写在nginx的配置文件nginx.conf里 也可以写在外部 用include的方式在nginx.conf里包含进来。
http://www.bkjia.com/phpjc/371849.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/371849.htmltecharticle今天安装完nginx 后 发现html页面能正常浏览 但是php文件的页面打开后是一篇空白 看php-fpm日志 看nginx日志都没找到问题 上网搜索了半天终于...
其它类似信息

推荐信息