Venerable monks,

I realize my problem is probably a trivial one, but I was unable to solve it do far...

I have been using Perl for standalone scripts for a little while, and just started to use it for CGI scripts...
The script in question is supposed to draw a graph based on data pulled from a mySQL database. The database part works fine, the script works well when used by itself. However, when I put it into cgi-bin folder for my apache server and try to run it, I get 500 Internal Server error...

The Apache is running, the config is valid and verified many times over, the script is in the right folder, and the permissions are correct (I believe chmod 755 does it right). Yet, it still gives me an error when I try to run the script...

Here is the code part that deals with graph generation (I removed everything else to test it). According to every source I could find - it should work... yet it does not

UPDATE: The problem solved... It seems strange behaviour to me, but here is the story: The script is created on Windows PC (CR/LF). Then, the script is transferred to Linux PC (CR), where it promptly stops working... Resolution: open script in vi, make a little change, save - it starts working... doh!

use CGI; use strict; use GD::Graph::lines; my @data = ( ["Jan-01","Feb-01","Mar-01", "Apr-01","May-01", "Jun-01","Jul-01","Aug-01","Sep-01"], [21,25,33,39,49,48,40,45,15] ); my $q = CGI->new; my $graph = new GD::Graph::lines; $graph->set( x_label => 'Month', y_label => 'Value', title => 'Test Graph', bar_spacing => 10 ) or warn $graph->error; $graph->plot(\@data) or die $graph->error; print $q->header(-type=>'image/jpeg'),$graph->gd->jpeg(100);
Can anyone point me in the right direction to find the answer? Many thanks to you all.

--------------------------------
An idea is not responsible for the people who believe in it...


In reply to Perl CGI gives HTTP error 500 by bofh_of_oz

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.