Nginx执行php显示no input file specified的处理方法
/var/www/nginx-default中放上一份phpinfo.php,使用http://localhost/phpinfo.info 访问,结果报错,显示 “No input file specified”
在ubuntu系统中,使用apt-get install nginx和php-cgi,配置好nginx和php。
在/var/www/nginx-default中放上一份phpinfo.php,使用
http://localhost/phpinfo.info
访问,结果报错,显示 “No input file specified”
现存的各种方案,是让你把nginx站点配置文件中的这一句话hardcode起来的(真想骂人):
# 即把fastcgi_param指令的SCRIPT_FILENAME项 从动态值改为fixed值,如:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# 修改为
fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;
另外还有一种是修改php.ini中的什么
cgi.fix_pathinfo=1
doc_root=
请注意!!以上这些都是非常不良的改动!
问题原因
导致“No input file specified. ”这个问题的原因,是因为nginx的配置不正确,从而导致CGI获取参数错误。
简单来说,是因为$document_root这个变量尚未定义。
Nginx的配置文件中,fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
是一个写在location块(通常是匹配php)中的指令语句。
而我们也知道,在nginx中,有三级的关系,http > server > location。
如果要在location块中使用$document_root,需要在上层server块或http块中定义了root指令,这样才能通过继承关系,在location块中用$document_root拿到root的值。而定义在别的location块中的root指令的值,是一个局部变量,其值无法在匹配php的这个location块中被获取。
因此,解决这个问题的办法,是把"/" location块中的root上提到server。
或者,在php的location块中,重新定义root。
备注:以上修改方法,供大家学习参考,请针对自己当前运行的nginx版本,采取必要措施。你懂的。
Nginx执行php显示no input file specified的处理方法的更多相关文章
- js获取input file完整路径的方法
function getPath(){ //判断浏览器 var Sys = {}; var obj = document.getElementById("headImg"); ...
- No input file specified的解决方法apache伪静态
http://jingyan.baidu.com/article/dca1fa6f8d623ff1a44052e8.html (一)IIS Noinput file specified 方法一:改PH ...
- 地址重写 No input file specified的解决方法
转载自:http://blog.csdn.net/williamsblog/article/details/37532737 (一)IIS Noinput file specified 方法一:改PH ...
- No input file specified的解决方法
(一)IIS Noinput file specified 方法一:改PHP.ini中的doc_root行,打开ini文件注释掉此行,然后重启IIS 方法二:请修改php.ini找到; cgi.for ...
- 提示No input file specified的解决方法
(一)IIS Noinput file specified 方法一:改PHP.ini中的doc_root行,打开ini文件注释掉此行,然后重启IIS 方法二: 请修改php.ini 找到 ; cgi. ...
- ThinkPHP 的URL重写时遇到No input file specified的解决方法
因为在Fastcgi模式下,php不支持rewrite的目标网址的PATH_INFO的解析 ThinkPHP运行在URL_MODEL=2时,会出现 No input file specified.的情 ...
- ThinkPHP的URL重写时遇到No input file specified的解决方法
因为在Fastcgi模式下,php不支持rewrite的目标网址的PATH_INFO的解析 ThinkPHP运行在URL_MODEL=2时,会出现 No input file specified.的情 ...
- ThinkPHP隐藏index.php出现No input file specified的解决方法
因为在Fastcgi模式下,php不支持rewrite的目标网址的PATH_INFO的解析 ThinkPHP运行在URL_MODEL=2时,会出现 No input file specified.的情 ...
- phpstudy5.6 No input file specified的解决方法
一.问题描述 5.6就提示这个错误,切换5.5就可以 二.原因分析 原因1:提示:“No input file specified.”原因在于使用的PHP5.6是fast_cgi模式,而在某些情况下, ...
随机推荐
- ACM The Famous Clock
The Famous Clock 时间限制:1000 ms | 内存限制:65535 KB 难度:1 描述 Mr. B, Mr. G and Mr. M are now in Warsaw, ...
- 移动端开发——javascript
javascript(简称js)语言在移动前端应用很广.可以说必不可少,许多效果都是和js相关的.包括现在移动端的一些框架.jqmobi.jqtouch.sencha touch.jquerymobi ...
- iebugs产生的原因,zoom:1的作用
zoom:1是针对ie的属性,可以激活hasLayout属性,关于hasLayout haslayout 是Windows Internet Explorer渲染引擎的一个内部组成部分.在Intern ...
- SQL Server 插入数据后获得自增主键值
通过SQLServer系统自带函数获取 String sql = "insert into goods values('" + TextBox1.Text + "',&q ...
- 30分钟学会使用grunt打包前端代码
http://www.cnblogs.com/yexiaochai/p/3603389.html
- Java横向、纵向合并图片
进行图片对比时候想把两张有差异的图片放到一起,方便人工查看下,在网上搜了一些,有纵向合并的. 将纵向合并的自己调整了下,源码如下: import java.io.File; import java.a ...
- How to use the Isolated Storage Explorer tool for Windows Phone
Isolated Storage Explorer is installed in the following location: Program Files (x86)\Microsoft SDKs ...
- linux下转换U盘文件系统
打算在windows 7 下复制一个12G 的文件至U盘,无奈U盘为FAT32格式,最大支持移动4G 的文件,只能将U盘文件系统格式化为NTFS.windows 7系统出现问题,转化中总是出现错误.故 ...
- [CareerCup] 15.7 Student Grade 学生成绩
15.7 Imagine a simple database storing information for students' grades. Design what this database m ...
- Jfinal中手动提交/回滚 事物
在Jfinal中有个Tx类为事物声明类 在方法或controller上面加@Before({Tx.class})即可,可是这样并不能满足有的业务场景 下面是今天写的手动提交的事物处理方法,希望对大家有 ...