whilst this is confusing for those new to perl/CGI...all the problems stem from the fact that the environment for a perl CGI in Apache is different to the environment you execute perl scripts directly yourself.
for a start, paths and file/directory permissions need to allow Apache (which runs as nobody or www user) to access perl + modules. Then you may also need to either configure Apache to run the cgi with perl by knowing the extension of the script (e.g. .cgi) OR you need to use a "shebang" line at the start of the script telling Apache (or anything else) that it needs to be executed with perl.
if you are the admin of the computer, you can "su - nobody" or "su - www" and try to execute your CGI script, to check for correct perl and file permissions. Also "telnet localhost 80" and then "GET /cgi-bin/yourcgi" sometimes gives more clues than "premature end of script headers".
Have fun with CGI, and be careful if you Apache is accessible on the internet, as CGI scripts can open up a vector for the box to get hacked.
the hardest line to type correctly is: stty erase ^H
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.