For some reason I can't get a perl script to run in the cgi-bin folder. I haven't made these files and we've uploaded them to another server and they work fine.
However I've used the following test.pl file which works fine through bash (as root) and through the browser.
#!/usr/bin/perl use strict; use warnings; #Useful for testing: Perl error messages, plus your die statements, will get #sent to the browser. Otherwise you will just see "Internal Server Error". use CGI::Carp qw/fatalsToBrowser/; #Always use the CGI module for your scripts. use CGI; #Create simple HTML output (taken directly from CGI documentation). my $q = CGI->new; # create new CGI object print $q->header, # create the HTTP header $q->start_html('hello world'), # start the HTML $q->h1('hello world'), # level 1 header $q->end_html; # end the HTML
The other scripts that are running use the exact same permissions and settings. However, the scripts just bring up a 500 error message unless I change the top line from
#!/usr/bin/perl -w (with warnings). The error log outputs the following error when i run it without the
[Fri Sep 26 12:06:03 2014] [error] [client xxx.xxx.xx.xxx] (2)No such file or directory: exec of '/var/www/html/foldername/cgi-bin/ss000001.pl' failed [Fri Sep 26 12:06:03 2014] [error] [client xxx.xxx.xx.xxx] Premature end of script headers: ss000001.pl
I should note that I can do
nano /var/www/html/foldername/cgi-bin/ss000001.pl which opens the file and changing perl to
-w does as explained above.
Does anyone know where I can start or see anything immediately wrong here?