用户工具

站点工具


winfcgiphperr

在Apache服务器上,采用模块化运行与采用FCGI运行方式的伪静态也是有差别的、

所以有的人在安装ThinkPHP V5的时候就会出现No input file specified.的错误提示

下面这个伪静态是Apache采用模块运行方式时需要配置的伪静态内容,详细的运行方式可查看我以往的博客内容

(如果您当前的Apache采用Fcgi模式运行PHP,那么这个伪静态就会出现“No input file specified.”的错误提示)

<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

上面的伪静态为什么有的人能正常使用,而有的人使用确出现“No input file specified.”的提示呢?

那是因为Apache只有采用fastcgi模式的时候,才出现不能识别PATH_INFO的情况,所以在windows下很多人安装ThinkPHP V5的时候都没出现这个问题,因为大部分windows用户安装的Apache是采用模块化运行方式的,而在linux上以及在windows系统下采用FCGI运行模式的都出现了“No input file specified.”提示。

如果你采用FCGI运行方式的时候出现此类提示,只需要把

RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

改写成

RewriteRule ^(.*)$ index.php [E=PATH_INFO:$1,QSA,PT,L] 即可,改写后的伪静态如下(注意E=PATH_INFO:$1)

<IfModule mod_rewrite.c>

Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [E=PATH_INFO:$1,QSA,PT,L]

</IfModule>

winfcgiphperr.txt · 最后更改: 2021/03/29 10:29 由 songdemei