I am trying to setup the apache web server on a linux fedora platform. Everything seems to be working with the exception of executing a perl script when invoked from a webpage. Every time I try to execute my perl script from my webpage I get an "500 Internal Server Error" and the following error logs:

(13)Permission denied: exec of '/cgi-bin/test.pl' failed Premature end of script headers: test.pl

I've triple checked the permissions of the cgi-bin directory and the perl script and they look fine...

drwxr-xr-x 2 root root 4096 Jul 1 17:38 cgi-bin [root@localhost cgi-bin]# ll -rwxr-xr-x 1 root root 159 Jul 1 17:38 test.pl

I've verified the location of my cgi-bin directory is correct. When I remove test.pl I get a "404 Not Found" error instead of the server error. I also verified the script runs fine from the command line. My script is very basic and intended only to verify I can execute perl scripts. Code is below...

#!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser); use strict; use warnings; print "Content-type: text/html\n\n"; print "testing testing\n"; exit;

Any thoughts on what I could be doing wrong would be greatly appreciated.


In reply to Premature end of script headers error by huklberry

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.