[rrd-users] rrdgraph cgi script fails under mod_perl

Nick Sharp njsharp at bigpond.net.au
Thu Feb 16 00:59:46 MET 2006


I have had a cgi script running well under Fedora Core 4 since about Sep 2005.

The key parts of the html page:

<img alt="graph here" width="897" height="279" src="cgi-bin/graphall.pl?site=auhq/>

and graphall.pl:

print "Content-type: image/png\n\n";
binmode(STDOUT);
RRDs::graph ("-", "-w 800", "-h 200" etc etc including use of 'auhq' to access the rrd

I desire to make this, and other cgi work, run under mod_perl instead, for the usual reasons.

My test OS is FC5-test2, which seems good.  Everything is recent releases (Apache 2.2.0, Perl 5.8.7,
MySQL 5.0.18, and so on.  But no RRDtool, sigh, so I built 1.2.12 exactly as at:
http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/doc/rrdbuild.en.html

The cgi script continues to run just fine under this newer environment.

I have been able to set up Apache and mod_perl and get it to run a simple text/html program, but
when I try to convert the graphall routine to mod_perl I get the alt "graph here" delivered, and no
graph.  And APPARENTLY nothing was added to /etc/httpd/logs/error_log.

When I replaced 'auhq' by 'junk' I then DID get a missing database error, because there is no 'junk'
rrd.  This made me feel confident that my code had caused graphall.pl to be run, but no image output
from it had reached the browser even when the site code was valid.

But when I stopped the httpd, I then found, and ONLY then, that a large number of these messages
could be seen in the error-log:

libpng error: write error

..perhaps some 6~10 for each attempt to run the program.  It is puzzling they only seem to emerge
into view after stopping httpd.

I see a few notes about that error in the archives, but none that seem to help me.

I am totally new to mod_perl so may well be doing Very Silly Things.
To the standard FC5 httpd.conf I appended:

Alias /perl/ /var/www/mod-perl/
PerlModule ModPerl::Registry
<Location /perl/>
	SetHandler perl-script
	PerlHandler ModPerl::Registry
	Options +ExecCGI
	PerlSendHeader On
	Allow from all
</Location>

very little of which I understand!  It is mostly lifted from Practical Mod_Perl

Obviously, I have created /var/www/mod-perl with a copy of graphall.pl executable by any.

I feel sure someone must have been there done this before, but I have worn out Mr Google looking for
clues!

As a check, I have re-run the tests on the same environment on a completely different PC, with an 
identical result.

Apologies in advance for any info I've left out; I'm sure I will be told!

Regards
Nick Sharp



--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list