开发者

CGI files causing 500 Internal Server Error

When I tried accessing my "hello world" perl script (hello.cgi) via the browser, the browser gives the 500 Internal Server Error.

However, when I changed the fi开发者_运维技巧le ending of that same file to hello.pl, I can access it just fine via the browser. I also tried troubleshooting this with a python script (hello.py) in the same directory and it works just fine.

I've changed the httpd.conf with the following:

AddHandler cgi-script .cgi .py .pl

AllowOverride None SetHandler cgi-script Options +ExecCGI Order allow,deny Allow from all

I've looked everywhere to resolve this problem, but nothing seems to work. Please help.


Make sure the shebang line is correct. The Apache server has to know where your perl interpreter is, i.e. where perl.exe is. If perl.exe isn't in /usr/bin/perl (like your shebang says) then it won't work.

I wasn't getting anything until I changed my shebang to #!C:/Program Files (x86)/Perl64/bin/perl.exe

(btw I know what it is like to look for ages for help with these things. Good luck!)


I would recommend:

  • Giving the script execute permissions using GoDaddy's web-based File Manager
  • If you are using Hosting Configuration prior to 2.0 then I believe your perl scripts can only be located in the cgi directory. Upgrade to 2.0+ and your perl scripts can reside anywhere on your hosting account.
  • Try to resave the perl script with unix line endings, or try editing it and saving it with GoDaddy's web-based File Manager (this is what ultimately worked for me)
  • As mentioned previously, it could also be incomplete HTTP headers being sent
  • If all else fails turn on error logging in the Hosting Manager and you will see a directory called Error Logs in the File Manager that should help you further.


You probably forgot print "Content-Type: text/html\n\n" or somesuch.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜