Apache (2) 抛出“No such file or directory: exec of '/usr/lib/cgi-bin/fst.cgi' failed" [英] Apache (2) throws "No such file or directory: exec of '/usr/lib/cgi-bin/fst.cgi' failed"

查看:36
本文介绍了Apache (2) 抛出“No such file or directory: exec of '/usr/lib/cgi-bin/fst.cgi' failed"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Ubuntu 10.10 (Maverick Meerkat) 中工作并在 CGI 脚本href="http://en.wikipedia.org/wiki/Apache_HTTP_Server" rel="noreferrer">Apache,但它显示了以下错误...

I am working in Ubuntu 10.10 (Maverick Meerkat) and running my CGI script under Apache, but it is showing me the following error...

[Sat errorNo such file or directory: exec of '/usr/lib/cgi-bin/fst.cgi' failed[Sat Oct 22 02:56:45 2011] [error] [client 127.0.0.1] 脚本头过早结束:fst.cgi

[Sat errorNo such file or directory: exec of '/usr/lib/cgi-bin/fst.cgi' failed [Sat Oct 22 02:56:45 2011] [error] [client 127.0.0.1] Premature end of script headers: fst.cgi

我的脚本是

#!/usr/bin/perl
print "Content-type:text/html\n\n";
print "hello world";

我已经设置了文件的权限...

I have set the permissions of the file...

我还在文件 apache.conf 中添加了以下行:

I have also added the following line in file apache.conf:

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

<Directory /usr/lib/cgi-bin/>
   Options +ExecCGI
</Directory>

AddHandler cgi-script .cgi .pl

但它仍然向我显示同样的错误.我已经做了所有可能的改变,但我没有得到任何成功......

But still it is showing me the same error. I have done all the possible changes, but I didn't get any success...

推荐答案

我遇到了在我的/var/log/apache2/error_log 中发现的相同错误.我终于意识到 Perl 脚本是直接从我的 Windows 系统(通过 Parallels 虚拟机)复制的,似乎是 Windows 的回车\r\n"导致了这个错误.

I encountered the same error found in my /var/log/apache2/error_log. I finally realized that the Perl script was directly copied from my Windows system (via Parallels virtual machine) and it seems that the Windows' carriage return "\r\n" causes this error.

当我使用 ASCII 模式将这个 Perl 脚本从 Windows FTP 到 Mac 时自动将\r\n"转换为\r",相同的 Perl 脚本无需任何修改即可正常工作.

When I FTP this Perl script from Windows to Mac using ASCII mode to automatically convert "\r\n" into "\r", the same Perl script works correctly without any modification.

这篇关于Apache (2) 抛出“No such file or directory: exec of '/usr/lib/cgi-bin/fst.cgi' failed"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆