在做nginx和php整合时,配置完nginx+fastcgi后,自己写了一个php测试文件,结果显示:<span style="color: #ff0000;">no input file specified</span>。
用google搜索了一堆,结果未能解决问题,看来别人的经验不是很适合我啊,只好自己调吧。结果搞了一下午没搞出来,
第二天一会就好了,郁闷啊。。。所以把自己的解决方法贴出来,分享一下。
修改php.ini文件:
cgi.fix_pathinfo=1(手动添加)
doc_root= (不需要改)
修改nginx.conf文件:
location ~ .php$ {#root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name; include fastcgi_params; }
重新启动nginx和php-fpm:
killall -HUP nginx/usr/local/php/sbin/php-fpm restart
最后,故障解决,访问正常。