Why does my Perl CGI script raise an internal server error on Apache?

Posted by itcplpl on Ask Ubuntu See other posts from Ask Ubuntu or by itcplpl
Published on 2011-10-24T15:15:04Z Indexed on 2012/09/30 21:50 UTC
Read the original article Hit count: 522

Filed under:
|
|

I've installed apache2 on Ubuntu 11.04, and localhost is working. I created a simple printenv.pl script and put it in the following directory

$ mv printenv.pl /usr/lib/cgi-bin/
$ chmod +rx /usr/lib/cgi-bin/printenv.pl

However when I go to http://127.0.0.1/cgi-bin/printenv.pl, I get a 500 Internal Server Error

I checked the error log at /var/log/apache2, and this is what it says:

[Mon Oct 24 11:04:25 2011] [error] (13)Permission denied: exec of '/usr/lib/cgi-bin/printenv.pl' failed
[Mon Oct 24 11:04:25 2011] [error] [client 127.0.0.1] Premature end of script headers: printenv.pl

Any suggestions on how I can fix this and run CGI scripts on my localhost?

© Ask Ubuntu or respective owner

Related posts about apache2

Related posts about perl