apache, gd and mod_perl2 problem
Thomas Vogt
thomas at bsdunix.ch
Fri Feb 16 12:19:25 UTC 2007
Hello
I've a strange problem with apache2.0, gd2 and mod_perl2.
I wrote a small test script which creates a png file in my /tmp
directory.
This perl script works fine if I run it localy on a shell, it works also
as normal cgi script but it doesn't work with apache2 and mod_perl2. It
crashes with: print HF $im->png; (see the whole script below)
httpd-error.log message (debug enabled)
[Tue Feb 13 09:41:34 2007] [notice] child pid 24480 exit signal Abort
trap (6)
t/www in free(): error: pointer to wrong page
The script I'm talking about:
cat buttontest.html
#!/usr/bin/perl
use GD;
# 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);
print "Content-type: text/html\n\n";
print "<h1>Hello world</h1>";
# make sure we are writing to a binary stream
open HF, ">/tmp/file.png";
binmode HF;
# Convert the image to PNG and print it on standard output
# here it crashes with apache
print HF $im->png;
close HF;
print "<p>Foobar";
my httpd.conf:
LoadModule perl_module libexec/apache2/mod_perl.so
PerlModule Apache2::Reload
<Location /perl>
# -- mod_perl stuff
SetHandler perl-script
PerlResponseHandler ModPerl::RegistryPrefork
PerlInitHandler Apache2::Reload
Options +ExecCGI
AddHandler cgi-script html png
PerlOptions +ParseHeaders
PerlSetVar StatINCDebug On
</Location>
My System:
6.2-RELEASE-p1 (i386)
Packets I use:
apache-2.0.59
png-1.2.12_1
perl-5.8.8
p5-GD-2.35
mod_perl2-2.0.3_
gd-2.0.33_4,11,3
freetype2-2.2.1_1
I compiled everything with -DWITHOUT_X11 knob but I also tested it with
X support too. It doesn't work either. I also tried mod_perl2-2.0.2 to
make sure it's not a new 2.0.3 bug.
The same script works fine on an Ubuntu Linux Server with apache2.0.x,
mod_perl2 and gd.
Any idea?
Regards,
Thomas
--
Terry Lambert:
"It is not unix's job to stop you from shooting your foot. If you so
choose to do so, then it is UNIX's job to deliver Mr. Bullet to Mr Foot
in the most efficient way it knows."
More information about the freebsd-apache
mailing list