bofh_of_oz has asked for the wisdom of the Perl Monks concerning the following question:
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!
Can anyone point me in the right direction to find the answer? Many thanks to you all.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);
--------------------------------
An idea is not responsible for the people who believe in it...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl CGI gives HTTP error 500
by Nevtlathiel (Friar) on May 06, 2005 at 13:11 UTC | |
Re: Perl CGI gives HTTP error 500
by dragonchild (Archbishop) on May 06, 2005 at 13:08 UTC | |
Re: Perl CGI gives HTTP error 500
by radiantmatrix (Parson) on May 06, 2005 at 14:34 UTC | |
Re: Perl CGI gives HTTP error 500
by cbrandtbuffalo (Deacon) on May 06, 2005 at 16:32 UTC | |
Re: Perl CGI gives HTTP error 500
by steelrose (Scribe) on May 06, 2005 at 17:53 UTC |