2

Im having some problems trying to run a perl script. I'm completely new to perl, and I'm thinking this has to do with apache not knowing what to do with the file.

Here's the code:

#!/usr/bin/perl

print "content-type: text/html \n\n";

print "Hello, Perl!";

Super simple. Running it from command line works perfecly

$/usr/bin/perl /var/www/html/test.pl

When I try to run it through a browser, it wants to download the file. Any ideas?

David
  • 2,094
  • 3
  • 30
  • 47
  • 7
    Have a look at this http://stackoverflow.com/questions/560749/how-do-i-configure-apache2-to-run-perl-cgi-scripts – Michel Feldheim Apr 24 '13 at 00:15
  • 1
    As you guessed correctly, this isn't related to Perl, but to configuring Apache correctly to know that your script should run as cgi-bin script. – DVK Apr 24 '13 at 00:59
  • So I tracked it down to the fact that the .pl script can't be run in anything except the cgi-bin folder. I changed the ftp user to be able to see that folder (the root was set in /www/html, the cgi-bin was in /www) chowned the folder to the user, but now it's throwing a 500 error when I try to run the script. – David Apr 24 '13 at 01:23
  • 2
    you're using strict and warnings, right? Look at the error log. – Devin Ceartas Apr 24 '13 at 02:55
  • I am, and I can't. for some reason (running as ec2-user) on an aws ec2, I can't get into the httpd error log directory. I've gotten this to the point that now it's giving me a permission denied error in the browser. But, alas, I'm still at a loss. It looks like all the permissions are set, +EregCGI is added to the httpd.conf file. I may just give up on this perl idea and stick to php. I've been trying to figure this out for 2 days. – David Apr 26 '13 at 15:43

0 Answers0