chakkaln has asked for the wisdom of the Perl Monks concerning the following question:
When I run the same script from the command line, it generate the binary for the image. Does this mean that my server configuration is not right?[Fri Jul 29 12:28:44 2005] [error] (8)Exec format error: exec of /home +/nagesh/apache/cgi-bin/simpleImage.cgi failed [Fri Jul 29 12:28:44 2005] [error] [client 127.0.0.1] Premature end of + script headers: /home/nagesh/apache/cgi-bin/simpleImage.cgi
simpleImage.cgi
I made the code executable by chmod 755 simpleImage.cgimy $LIB = defined $ENV{LD_LIBRARY_PATH} ? $ENV{LD_LIBRARY_PATH} : ""; $ENV{LD_LIBRARY_PATH} = "/usr/lib:$LIB"; #!/usr/local/bin/perl use strict; use GD; use CGI; # This creates a Web GIF image on the fly # create a new image $im = new GD::Image(1000,100); # allocate some colors $white = $im ->colorAllocate(255,255,255); $black= $im ->colorAllocate(0,0,0); $red = $im ->colorAllocate(255,100,0); $blue= $im ->colorAllocate(0,150,255); $yellow= $im ->colorAllocate(255,200,0); $pink= $im ->colorAllocate(150,0,150); $im->filledRectangle(10,5,990,15,$pink); $im->arc(10,10,10,10,0,360,$black); $im->fill(10,10,$white); $im->arc(990,10,10,10,270,90,$black); $im->fillToBorder(990,10,$black,$pink); # Convert the image to GIF and print it on standard output #binmode STDOUT; print "Content-type: image/gif\n\n"; print $im->gif;
This problem does not occur when I tested with a simple cgi script to check whether the server is able to execute the .cgi script and indeed it was working fine as I got some display on the browser. test.cgi #!/usr/local/bin/perl -w use strict; use CGI; my $cgi = new CGI; print $cgi->header(-type => 'text/html'); print "This is a test message"; Thanks very much in advance. Nagesh
Update: Got the problem fixed. Thanks to all of you guys who helped out. See you all very soon with more problems Cheers
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem running cgi script (Exec format error)
by Anonymous Monk on Jul 29, 2005 at 03:13 UTC | |
by chakkaln (Sexton) on Jul 29, 2005 at 03:19 UTC | |
by chakkaln (Sexton) on Jul 29, 2005 at 03:25 UTC | |
by Anonymous Monk on Jul 29, 2005 at 03:47 UTC | |
by chakkaln (Sexton) on Jul 29, 2005 at 04:58 UTC | |
|
Re: Problem running cgi script (Exec format error)
by tlm (Prior) on Jul 29, 2005 at 08:28 UTC |