GD demo cgi script works on command line but not on webserver.
am 14.06.2006 11:07:31 von PeroliHi all,
I recently installed GD version 2.34. The installation process went
well, except that it said, it cannot find -liconv library. It also said
its harmless.
I executed the demo script GD-2.34/demo/shapes.pl and it worked
well.
Then I executed GD-2.34/demo/gd_example.cgi, where i changed the
shebang line to the right version of perl and it failed. The error is
as follows:
#####################################
Can't load
'/apps/yell/perl/sun4/5.8.7/lib/site_perl/5.8.7/sun4-solaris //auto/GD/GD.so'
for module GD: ld.so.1: /apps/yell/perl/sun4/5.8.7/bin/perl: fatal:
libjpeg.so.62: open failed: No such file or directory at
/apps/yell/perl/sun4/5.8.7/lib/5.8.7/sun4-solaris/DynaLoader .pm line
230.
at /opt/apache/socdb-tii/cgi-bin/gd_example.cgi line 3
Compilation failed in require at
/opt/apache/socdb-tii/cgi-bin/gd_example.cgi line 3.
BEGIN failed--compilation aborted at
/opt/apache/socdb-tii/cgi-bin/gd_example.cgi line 3.
[Wed Jun 14 14:12:12 2006] [error] [client 172.24.170.192] Premature
end of script headers: /opt/apache/socdb-tii/cgi-bin/gd_example.cgi
#####################################
source file:
#####################################
#!/apps/yell/perl/sun4/5.8.7/bin/perl
use GD;
print "Content-type: image/png\n\n";
# create a new image
$im = new GD::Image(100,100);
# allocate some colors
$white = $im->colorAllocate(255,255,255);
$black = $im->colorAllocate(0,0,0);
$red = $im->colorAllocate(255,0,0);
$blue = $im->colorAllocate(0,0,255);
# make the background transparent and interlaced
$im->transparent($white);
$im->interlaced('true');
# Put a black frame around the picture
$im->rectangle(0,0,99,99,$black);
# Draw a blue oval
$im->arc(50,50,95,75,0,360,$blue);
# And fill it with red
$im->fill(50,50,$red);
binmode STDOUT;
# Convert the image to PNG and print it on standard output
print $im->png();
#########################################
Running it on the command line works fine. I don't know why it fails
while apache is executing it.
-- Peroli Sivaprakasam