Hi Monks, I have finished a cgi script and tested in on the command line. Then I put it into the cgi-bin on my web server, set the permissions to 755 owner root. When I execute the cgi script in the browser I get the following error:
Internal Server Error The server encountered an internal error or misconfiguration and was u +nable to complete your request.
I looked in the errorlog for the apache server and found the following error:
Thu Feb 12 02:02:41 1998] [error] (2)No such file or directory: exec o +f /var/www/cgi-bin/generateStatistics.cgi failed Thu Feb 12 02:02:41 1998] [error] [client 213.237.88.236] Premature en +d of script headers: /var/www/cgi-bin/generateStatistics.cgi
Do any of you gurus know what could be wrong? I also executed the cgi script and redirected the output to out.html and I had no problem viewing it in the browser. Here is the cgi code:
#!/usr/bin/perl open (IN_RESULT,"statistics.txt"); @IN_RESULT = <IN_RESULT>; close (IN_RESULT); @armyImages = ('"images/icon_army_dwarf.gif"', '"images/icon_army_empire.gif"', '"images/icon_army_lizard.gif"', '"images/icon_army_orcs.gif"', '"images/icon_army_skaven.gif"' ); print <<WEB_PAGE; <html> <head> <title>Statistics</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +"> <STYLE> <!-- A{text-decoration:none} --> </STYLE> <style> body { scrollbar-base-color: #000000; } </style> </head> <body bgcolor="#000000" text="#E6941A" background="images/background2. +gif"> <table width="0" border="0" cellpadding="0" cellspacing="0" height="0" +> <tr> <td width="6" height="6"><img src="images/menu_top_left_border.gif +" width="6" height="6"></td> <td width="118" height="6"><img src="images/menu_top_border.gif" w +idth="118" height="6"></td> <td width="85" height="6"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="6"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="6"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="6"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="6"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="6"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="6"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="6"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="6"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="6"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="10" height="6"><img src="images/menu_top_right_border.g +if" width="6" height="6"></td> </tr> <tr> <td width="6" height="25"><img src="images/menu_side_border.gif" w +idth="6" height="37"></td> <td width="118" height="25"><a href="javascript: window.open('stat +istics_administrator.htm','','status=yes, width=600,height=300'); voi +d('');"><img src="images/statistics_icon.gif" width="118" height="36" + border="0"></a></td> <td width="85" height="25"><img src="images/flag_massacre_victory. +gif" width="85" height="36"></td> <td width="85" height="25"><img src="images/flag_major_victory.gif +" width="85" height="36"></td> <td width="85" height="25"><img src="images/flag_minor_victory.gif +" width="85" height="36"></td> <td width="85" height="25"><img src="images/flag_draw.gif" width=" +85" height="36"></td> <td width="85" height="25"><img src="images/flag_minor_defeat.gif" + width="85" height="36"></td> <td width="85" height="25"><img src="images/flag_major_defeat.gif" + width="85" height="36"></td> <td width="85" height="25"><img src="images/flag_massacre_defeat.g +if" width="85" height="36"></td> <td width="85" height="25"><img src="images/flag_total_victories.g +if" width="85" height="36"></td> <td width="85" height="25"><img src="images/flag_total_defeats.gif +" width="85" height="36"></td> <td width="85" height="25"><img src="images/flag_total_battles.gif +" width="85" height="36"></td> <td width="10" height="25"><img src="images/menu_side_border.gif" +width="6" height="37"></td> </tr> WEB_PAGE $imageCount = 0; foreach $entry (@IN_RESULT) { @current = split (':',$entry); print <<WEB_PAGE; <tr> <td width="6"><img src="images/menu_side_border.gif" width="6" hei +ght="37"></td> <td width="118"><img src=@armyImages[$imageCount] width="85" heigh +t="36"></td> <td width="85" align="center" valign="middle">@current[1]</td> <td width="85" align="center" valign="middle">@current[2]</td> <td width="85" align="center" valign="middle">@current[3]</td> <td width="85" align="center" valign="middle">@current[4]</td> <td width="85" align="center" valign="middle">@current[5]</td> <td width="85" align="center" valign="middle">@current[6]</td> <td width="85" align="center" valign="middle">@current[7]</td> <td width="85" align="center" valign="middle">@current[8]</td> <td width="85" align="center" valign="middle">@current[9]</td> <td width="85" align="center" valign="middle">@current[10]</td> <td width="10"><img src="images/menu_side_border.gif" width="6" he +ight="37"></td> </tr> WEB_PAGE $count++; } print <<WEB_PAGE; <tr> <td width="6" height="2"><img src="images/menu_buttom_left_border. +gif" width="6" height="6"></td> <td width="118" height="2"><img src="images/menu_top_border.gif" w +idth="118" height="6"></td> <td width="85" height="2"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="2"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="2"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="2"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="2"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="2"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="2"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="2"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="2"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="85" height="2"><img src="images/menu_side_border_medium +.gif" width="85" height="6"></td> <td width="10" height="2"><img src="images/menu_buttom_right_borde +r.gif" width="6" height="6"></td> </tr> </table> <p>&nbsp;</p> <p>&nbsp;</p> </body> </html> WEB_PAGE
Thanks!

In reply to Apache+cgi problem by RuneK

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.