【发布时间】:2015-06-23 20:54:18
【问题描述】:
我将此添加到我的 .htaccess 文件中:
AddHandler fcgid-script .test
(我正在使用 FastCGI / VirtualMin / WebMin)
并用内容创建了一个 test.test 文件;
<?php echo "test"; ?>
这会导致内部服务器错误,并在错误日志中显示此消息:
[Thu Apr 16 14:12:57.631287 2015] [fcgid:warn] [pid 2646] (104)Connection reset by peer: [client xxxx:53595] mod_fcgid: error reading data from FastCGI server
[Thu Apr 16 14:12:57.631402 2015] [core:error] [pid 2646] [client xxxx:53595] End of script output before headers: test.test
我做错了什么?我尝试使用不同的处理程序名称,例如 x-httpd-php 或 x-httpd-php5 但这根本没有任何作用。
我也试过了:
<FilesMatch "\.test$">
SetHandler fcgid-script
</FilesMatch>
但它有相同的内部服务器错误。
【问题讨论】:
-
“头文件前的脚本输出结束” - 也许你必须设置一些头文件来定义文件类型?
-
@MilanG 如我所见,日志中有 2 条错误消息,而第二条("End of script output before the headers")可能只是第一个的结果。
-
cgi 脚本必须是应用程序,即第一行必须是
#!/usr/bin/php(解释器路径)
标签: php apache .htaccess mod-fcgid