子目录PHP提示no input file specified处理办法

94次阅读

共计 2257 个字符,预计需要花费 6 分钟才能阅读完成。

首先直接访问资源或者静态资源看看能否获取,如果还是报这个错,直接删掉当前目录下的 .user.ini 即可,这个文件的作用是 防跨站

如果不是,考虑按以下方案处理:

一、IIS Noinput file specified

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
方法一:改 PHP.ini 中的 doc_root 行,打开ini 文件注释掉此行,然后重启IIS
方法二:
请修改php.ini
找到
; cgi.force_redirect = 1
去掉前面分号,把后面的 1 改为0
cgi.force_redirect = 0

二、apache No input file specified

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
apache No input filespecified,今天是我们配置 apache RewriteRule 时出现这种问题,解决办法很简单如下
打开 .htaccess RewriteRule 后面的 index.php 教程后面添加一个“?
完整代码如下
.htaccess
RewriteEngine on
RewriteCond $1 !^(index.php|images|robots.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]
如果是 apache 服务器出问题,看看是不是的 Apache .php 后缀的文件解析哪里有问题了。
总结
Apache 将哪些后缀作为 PHP 解析。例如,让 Apache .php 后缀的文件解析为 PHP。可以将任何后缀的文件解析为 PHP,只要在以下语句中加入并用空格分开。这里以添加一个 .phtml 来示例。
AddType application/xhttpdphp .php .phtml
为了将 .phps 教程作为 PHP 的源文件进行语法高亮显示,还可以加上:
AddType application/xhttpdphpsource .phps

三、nginx配置遭遇 No inputfile specified

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
虚拟机测试 nginx 遭遇 Noinput file specified,多方查找终于找到解决办法
1 php.ini(/etc/php5/cgi/php.ini)的配置中这两项
cgi.fix_pathinfo=1 (这个是自己添加的)
doc_root=
2nginx配置文件 /etc/nginx/sitesavailable/default 中注意以下部分
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/nginxdefault$fastcgi_script_name;
include fastcgi_params;
}
上面的部分路径需要根据你主机主目录的实际情况填写
配置完以上部分,重启一下service nginx restart,应该没问题了

 

正文完
 0