问题描述
我正在运行 Anchor CMS,我刚刚升级到 0.8 版.当我尝试运行安装程序时,出现未指定输入文件"错误.我认为这很可能是 .htaccess 问题,但我不确定正确的设置应该是什么.
I'm running Anchor CMS and 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.
可以在此处找到我的网站.
我的 .htaccess 设置为:
My .htaccess is set to:
<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>
如果有帮助,我也会使用 GoDaddy 作为托管服务提供商.
I'm also using a GoDaddy as the hosting provider if that helps.
推荐答案
No input file specified 是由于服务器上的 PHP 实现而向您显示的消息,在这种情况下表示 CGI 实现(可以使用 phpinfo()
进行验证).
The No input file specified is 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()
).
现在,要正确解释这一点,您需要对系统如何处理 URL 有一些基本的了解.根据您的 .htaccess 文件,您的 CMS 似乎希望 URL 作为 PATH_INFO
变量传递.CGI 和 FastCGI 实现没有 PATH_INFO
可用,因此当尝试传递 URI 时,PHP 会失败并显示该消息.
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_INFO
variable. CGI and FastCGI implementations do not have PATH_INFO
available, so when trying to pass the URI along, PHP fails with that message.
我们需要找到替代方案.
We need to find an alternative.
一种选择是尝试解决此问题.查看核心php.ini指令的文档,您可以看到您可以更改实现的工作方式.不过,GoDaddy 可能不允许您在共享环境中更改 PHP 设置.
One option is to try and fix this. Looking into the documentation for core php.ini directives you 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 设置的替代方法
查看第 40 行的 system/uri.php
,您将看到 CMS 尝试了两种类型的 URI 检测 - 第一种是 PATH_INFO
,我们刚刚了解到它不会工作 - 另一个是 REQUEST_URI
.
We need to find an alternative to modifying PHP settings
Looking into system/uri.php
on 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
.
这基本上应该足够了 - 但是解析传递的 URI 会给您带来更多麻烦,因为您可以传递给 REQUEST_URI
变量的 URI 会强制 parse_url()
只返回 URL 路径 - 这基本上让你回到零.
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_URI
variable, forces parse_url()
to only return the URL path - which basically puts you back to zero.
现在,实际上只剩下一种可能性了——那就是改变 CMS 的核心.URI检测部分不足.
Now, there's actually only one possibilty left - and that's changing the core of the CMS. The URI detection part is insufficient.
将 QUERY_STRING
添加到第 40 行的数组中,作为 system/uri.php
中的第一个元素,并将您的 .htaccess 更改为这个:
Add QUERY_STRING
to the array on line 40 as the first element in system/uri.php
and change your .htaccess to look like this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
这会将您请求的 URI 作为 QUERY_STRING
传递给 index.php
并通过 URI 检测找到它.
This will pass the URI you request to index.php
as QUERY_STRING
and have the URI detection to find it.
另一方面,这使得在不改变核心文件的情况下更新 CMS 是不可能的,直到这个问题得到修复.太烂了...
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.
这篇关于未指定输入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!