configuring apache to run perl script errors
file permissions deny server execution: /home/scf-03/taian/apache_1.3.26/cgi-bin/test-cgi如果无法运行测试文件,如同提示所说的,是权限问题,需要用chmod修改执行(x)权限,
If you cannot run the test file, simply change the permission, using chmod to add exec to it.
chmod example:
chmod 0755 filename
chmod ug+wx filename, user and group, add write and exec
cgi-bin文件夹的权限也有可能要修改.
You might need to change the permission of the folder as well.
(13)Permission denied: exec of /home/scf-03/taian/apache_1.3.26/cgi-bin/helloWorld.pl failed
(8)Exec format error: exec of /home/scf-03/taian/apache_1.3.26/cgi-bin/helloWorld.pl failed
很多问题都可能导致这个问题, 有一个共同的可能:
There is one common cause for these problems:
#!/usr/local/bin/perl
检查这一行有没有在perl文件第一行,这个一行是有意义的也是必须的,而且路径必须正确!
学校服务器的perl路径就不是这个,最终也是原因所在。这一行的存在在于提示服务器用什么来解析该文件/脚本,如果随便写一点东西什么的会得到错误(8)
The "#" is a remark command. You HAVE to leave it
in for the first line so your script can find the "Perl" program.
Check with your provider for the right path to the "Perl" program.
Set the permissions every time you upload or edit your file.
还需要查httpd.conf文件的配置,如果需要cgi,需要uncomment掉一行.
Also check the httpd.conf file, if you need to enable cgi script, you need to uncomment a line
还需要加入, also add
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory /usr/lib/cgi-bin/>
Options +ExecCGI
</Directory>
AddHandler cgi-script .cgi .pl
另外在一个主页的设定里面,最把如下扩展名加入
Also it's better to add those postfix/type to the configuration line
.pl, .py, .php
http://www.thesitewizard.com/archive/servererror.shtml
这篇文章提到FTP软件上传改变文件格式为binary,而我们需要ASCII模式。。。
注:笔者试验用FileZilla上传Perl文件,改变权限什么的,貌似在服务器上可以运行,所谓模式问题并没有造成 HTTP Error 500 Internal server error
This article also mentions that some FTP software might change the file type from ASCII to Binary.
NOTICE: I use FileZilla to upload my Perl script, as well as change the permission, it works just fine on the server. I didn't get that HTTP Error 500 Internal server error
http://www.slingcode.com/suexec.php
这篇文章有更详细的解释,关于suexec,赞一个!
This article has a detailed explanation about suexec, nice~
页:
[1]