php 未指定输入文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14555996/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
No input file specified
提问by Cole Roberts
I'm running Anchor CMSand I just upgraded to version 0.8. When I try and run the installer I get a 'No input file specified' error. I believe it's more than likely a .htaccess problem but I'm not sure what the correct settings should be.
我正在运行Anchor CMS,我刚刚升级到 0.8 版。当我尝试运行安装程序时,出现“未指定输入文件”错误。我相信这很可能是 .htaccess 问题,但我不确定正确的设置应该是什么。
My site can be found here.
我的网站可以在这里找到。
My .htaccess is set to:
我的 .htaccess 设置为:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase {base}
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ {index} [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
I'm also using a GoDaddy as the hosting provider if that helps.
如果有帮助,我也使用 GoDaddy 作为托管服务提供商。
回答by Repox
The No input file specifiedis a message you are presented with because of the implementation of PHP on your server, which in this case indicates a CGI implementation (can be verified with phpinfo()).
在没有指定输入文件是你都因为PHP的服务器,在这种情况下,指示执行CGI(可以验证该实现的一个消息phpinfo())。
Now, to properly explain this, you need to have some basic understanding on how your system works with URL's. Based on your .htaccess file, it seems that your CMS expects the URL to passed along as a PATH_INFOvariable. CGI and FastCGI implementations do not have PATH_INFOavailable, so when trying to pass the URI along, PHP fails with that message.
现在,为了正确解释这一点,您需要对系统如何使用 URL 有一些基本的了解。根据您的 .htaccess 文件,您的 CMS 似乎希望 URL 作为PATH_INFO变量传递。CGI 和 FastCGI 实现不可PATH_INFO用,因此当尝试传递 URI 时,PHP 会失败并显示该消息。
We need to find an alternative.
我们需要找到替代方案。
One option is to try and fix this. Looking into the documentation for core php.ini directivesyou can see that you can change the workings for your implementation. Although, GoDaddy probably won't allow you to change PHP settings on a shared enviroment.
一种选择是尝试解决此问题。查看核心 php.ini 指令的文档,您可以看到您可以更改实现的工作方式。虽然,GoDaddy 可能不允许您在共享环境中更改 PHP 设置。
We need to find an alternative to modifying PHP settings
Looking into system/uri.phpon line 40, you will see that the CMS attempts two types of URI detection - the first being PATH_INFO, which we just learned won't work - the other being the REQUEST_URI.
我们需要找到修改PHP设置一个替代
展望system/uri.php第40行,你会看到,CMS尝试两种类型的URI的检测-第一个是PATH_INFO,我们刚刚得知将无法正常工作-另一个是REQUEST_URI。
This should basically, be enough - but the parsing of the URI passed, will cause you more trouble, as the URI, which you could pass to REQUEST_URIvariable, forces parse_url()to only return the URL path - which basically puts you back to zero.
这基本上应该足够了 - 但是解析传递的 URI 会给您带来更多麻烦,因为您可以传递给REQUEST_URI变量的 URI强制parse_url()仅返回 URL 路径 - 这基本上使您回到零。
Now, there's actually only one possibilty left - and that's changing the core of the CMS. The URI detection part is insufficient.
现在,实际上只剩下一种可能性了——那就是改变 CMS 的核心。URI 检测部分不足。
Add QUERY_STRINGto the array on line 40 as the first elementin system/uri.phpand change your .htaccess to look like this:
添加QUERY_STRING到第 40 行的数组作为第一个元素,system/uri.php并将您的 .htaccess 更改为如下所示:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/ [L]
This will pass the URI you request to index.phpas QUERY_STRINGand have the URI detection to find it.
这会将您请求的 URI 传递给index.phpasQUERY_STRING并让 URI 检测找到它。
This, on the other hand, makes it impossible to update the CMS without changing core files till this have been fixed. That sucks...
另一方面,这使得在修复此问题之前无法在不更改核心文件的情况下更新 CMS。真烂...
Need a better option?
Find a better CMS.
需要更好的选择吗?
寻找更好的 CMS。
回答by chetan
Citing http://support.statamic.com/kb/hosting-servers/running-on-godaddy:
引用http://support.statamic.com/kb/hosting-servers/running-on-godaddy:
If you want to use GoDaddy as a host and you find yourself getting "No input file specified" errors in the control panel, you'll need to create a
php5.inifile in your weboot with the following rule:
cgi.fix_pathinfo = 1
如果您想使用 GoDaddy 作为主机并且您发现自己在控制面板中收到“未指定输入文件”错误,您需要
php5.ini使用以下规则在您的 weboot 中创建一个文件:
cgi.fix_pathinfo = 1
best easy answer just one line change and you are all set.
最好的简单答案只需更改一行即可。
recommended for godaddy hosting.
推荐用于godaddy 托管。
回答by jbaylina
In my case, there were an error in the php.ini open_basedir variable.
就我而言,php.ini open_basedir 变量中存在错误。
回答by webicy
I had the same problem. All I did to fix the issue was to modify my htacces file like this:
我有同样的问题。我为解决这个问题所做的只是修改我的 htacces 文件,如下所示:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /crm/
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^mywebsite.com [NC]
RewriteRule ^(.*)$ http://www.mywebsite.com/ [L,R=301]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^index.php/(.*)$ [L]
</IfModule>
回答by DragonLord
GoDaddy is currently (Feb '13) supporting modification of FastCGI for some accounts using PHP 5.2.x or earlier. See GoDaddy article "Disabling FastCGI in Your Hosting Account".
(In my case, this is apparently necessary to help get the current version of LimeSurvey (2.0) towards a running state.)
GoDaddy 目前(2013 年 2 月)支持为某些使用 PHP 5.2.x 或更早版本的帐户修改 FastCGI。请参阅 GoDaddy 文章“在您的主机帐户中禁用 FastCGI”。
(就我而言,这显然有助于使当前版本的 LimeSurvey (2.0) 进入运行状态。)
回答by user2060571
It worked for me..add on top of .htaccess file. It would disable FastCGI on godaddy shared hosting account.
它对我有用..添加在 .htaccess 文件之上。它会在 Godaddy 共享主机帐户上禁用 FastCGI。
Options +ExecCGI
选项 +ExecCGI
addhandler x-httpd-php5-cgi .php
addhandler x-httpd-php5-cgi .php
回答by jondinham
Adding php5.ini doesn't work at all. But see the 'Disable FastCGI' section in this article on GoDaddy: http://support.godaddy.com/help/article/5121/changing-your-hosting-accounts-file-extensions
添加 php5.ini 根本不起作用。但请参阅这篇关于 GoDaddy 的文章中的“禁用 FastCGI”部分:http: //support.godaddy.com/help/article/5121/changed-your-hosting-accounts-file-extensions
Add these lines to .htaccess files (webroot & website installation directory):
将这些行添加到 .htaccess 文件(webroot 和网站安装目录):
Options +ExecCGI
addhandler x-httpd-php5-cgi .php
It saves me a day! Cheers! Thanks DragonLord!
它节省了我一天的时间!干杯! 感谢龙王!
回答by Yarin Gold
Run ulimit -n 2048
跑 ulimit -n 2048
And restart php/php-fpm
并重新启动 php/php-fpm
回答by PauloBoaventura
Update
更新
All the previous reviews were tested by me, but there was no solution. But I did not give up.
之前的所有评论都经过我的测试,但没有解决方案。但我没有放弃。
SOLUTION
解决方案
Uncomment the following lines in my NGINX configuration
在我的 NGINX 配置中取消注释以下行
[/etc/nginx/site-avaible/{sitename}.conf]
The same code should follow in the site-enable folder
站点启用文件夹中应遵循相同的代码
#fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
And comment this:
并对此发表评论:
fastcgi_param SCRIPT_FILENAME / www / {namesite} / public_html $ fastcgi_script_name;
I changed several times from the original:
我从原来的改变了几次:
#fastcgi_pass unix: /var/php-nginx/9882989289032.sock;
Going back to this:
回到这个:
#fastcgi_pass 127.0.0.1:9007;
And finally I found what worked ...
最后我找到了有效的方法......
fastcgi_pass localhost: 8004;
I also recommend these lines...
我也推荐这些线路...
#fastcgi_index index.php;
#include fastcgi_params;
And even the FastCGI timeout (only to improve performance)
甚至 FastCGI 超时(仅用于提高性能)
fastcgi_read_timeout 3000;
During the process, I checked the NGINX log for all modifications. (This is very important because it shows the wrong parameter.)
在此过程中,我检查了 NGINX 日志中的所有修改。(这很重要,因为它显示了错误的参数。)
In my case it is like this, but it depends on the configuration:
在我的情况下是这样的,但这取决于配置:
error_log/var/log/nginx/{site}_error_log;
Test the NGINX Configuration
测试 NGINX 配置
nginx -t
Attention this is one of the options ... Well on the same server, what did not work on this site works on others ... So keep in mind that the settings depends on the platform.
注意这是选项之一......好吧,在同一台服务器上,在本网站上不起作用的东西在其他人身上起作用......所以请记住,设置取决于平台。
In this case it was for Joomla CMS.
在这种情况下,它用于 Joomla CMS。
回答by Accountant ?
In my case, I fixed it by butting the rules inside a LocationMatch Directive
就我而言,我通过在LocationMatch 指令中对接规则来修复它
<LocationMatch "^/.">
#your rewrite rules here
</LocationMatch>
/.matches anylocation
/.匹配任何位置
I have the rewrite rules inside one of the .conffiles of Apache NOT .htaccessfile.
我在.confApache NOT文件的文件之一中有重写规则。.htaccess
I don't know why this worked with me, this is my current setup
我不知道为什么这对我有用,这是我当前的设置
- Apache version 2.4
- PHP 7.1
- OS Centos 7
- PHP-FPM
- Apache 2.4 版
- PHP 7.1
- 操作系统 Centos 7
- PHP-FPM

