阿帕奇(2)抛出"没有这样的文件或目录:“/usr/lib/cgi-bin/fst.cgi'的执行失败" [英] Apache (2) throws "No such file or directory: exec of '/usr/lib/cgi-bin/fst.cgi' failed"

查看:638
本文介绍了阿帕奇(2)抛出"没有这样的文件或目录:“/usr/lib/cgi-bin/fst.cgi'的执行失败"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu 10.10(小牛獴)工作,并在<运行我的 CGI脚本 HREF =htt​​p://en.wikipedia.org/wiki/Apache_HTTP_Server相对=nofollow>阿帕奇,但它显示我下面的错误...

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

[周六errorNo这样的文件或目录:/usr/lib/cgi-bin/fst.cgi'的执行失败
  [周六10月22日2点56分45秒2011] [错误] [客户端127.0.0.1]脚本头premature结束: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 /日志/的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.

在我的FTP这个Perl脚本从Windows到Mac使用ASCII模式
自动转换为\\ 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.

这篇关于阿帕奇(2)抛出&QUOT;没有这样的文件或目录:“/usr/lib/cgi-bin/fst.cgi'的执行失败&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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