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

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

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
# Put a black frame around the picture

# Draw a blue oval

# And fill it with 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

My System:
6.2-RELEASE-p1  (i386)

Packets I use:

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?

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."

freebsd-questions@freebsd.org mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to