I'm trying to run my first cgi script using gd graphics. Text in the cgi script appears on the web page when the page called via the browser , but no graphics are present on the page. I'm using gd, but the error log suggests I have forgotten to load it. I thought I had installed/loaded it, but given my track record so far, I probably havn't. I hope the following info gives some clue as to what I've done, (I apologise for the format but it seems very difficult to have to put all the br breaks in)
I'm using perl 5.8.1
Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration:
Platform: osname=linux, osvers=2.4.7-10, archname=i686-linux uname='linux localhost.localdomain 2.4.7-10 #1 thu sep 6 17:27:27 +edt 2001 i686 unknown ' config_args='-de' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultipl +icity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LA +RGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2', cppflags='-fno-strict-aliasing -I/usr/local/include -I/usr/include +/gdbm' ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.1 2.96-98 +)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +2 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=/lib/libc-2.2.4.so, so=so, useshrplib=false, libperl=libperl. +a gnulibc_version='2.2.4' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynami +c' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: USE_LARGE_FILES Built under linux Compiled at Oct 4 2003 12:00:41 @INC: /usr/local/lib/perl5/5.8.1/i686-linux /usr/local/lib/perl5/5.8.1 /usr/local/lib/perl5/site_perl/5.8.1/i686-linux /usr/local/lib/perl5/site_perl/5.8.1 /usr/local/lib/perl5/site_perl .
The modules that are loaded....
Compress::Zlib -- 1.22 GD -- 2.07 Perl -- 5.8.1 Text::Format -- 0.52
The lib directories....
/usr/local/lib total 6020 drwxr-xr-x 4 root root 4096 Oct 10 05:54 . drwxr-xr-x 14 root root 4096 Oct 7 20:14 .. -rw-r--r-- 1 root root 2774930 Oct 10 05:04 libfreetype.a -rwxr-xr-x 1 root root 738 Oct 10 05:04 libfreetype.la lrwxrwxrwx 1 root root 20 Oct 10 05:04 libfreetype.so + -> libfreetype.so.6.3.4 lrwxrwxrwx 1 root root 20 Oct 10 05:04 libfreetype.so +.6 -> libfreetype.so.6.3.4 -rwxr-xr-x 1 root root 1307842 Oct 10 05:04 libfreetype.so +.6.3.4 -rw-r--r-- 1 root root 821148 Oct 10 05:54 libgd.a -rwxr-xr-x 1 root root 802 Oct 10 05:54 libgd.la lrwxrwxrwx 1 root root 14 Oct 10 05:54 libgd.so -> li +bgd.so.2.0.0 lrwxrwxrwx 1 root root 14 Oct 10 05:54 libgd.so.2 -> +libgd.so.2.0.0 -rwxr-xr-x 1 root root 507927 Oct 10 05:54 libgd.so.2.0.0 -rw-r--r-- 1 root root 219834 Oct 10 05:26 libpng12.a lrwxrwxrwx 1 root root 13 Oct 10 05:26 libpng12.so -> + libpng12.so.0 lrwxrwxrwx 1 root root 19 Oct 10 05:26 libpng12.so.0 +-> libpng12.so.0.1.2.5 -rwxr-xr-x 1 root root 196358 Oct 10 05:26 libpng12.so.0. +1.2.5 lrwxrwxrwx 1 root root 10 Oct 10 05:26 libpng.a -> li +bpng12.a lrwxrwxrwx 1 root root 11 Oct 10 05:26 libpng.so -> l +ibpng.so.3 lrwxrwxrwx 1 root root 17 Oct 10 05:26 libpng.so.3 -> + libpng.so.3.1.2.5 -rwxr-xr-x 1 root root 196358 Oct 10 05:26 libpng.so.3.1. +2.5 -rwxr-xr-x 1 root root 65880 Oct 10 04:55 libz.a drwxr-xr-x 4 root root 4096 Oct 10 15:56 perl5 drwxr-xr-x 2 root root 4096 Oct 10 05:26 pkgconfig
The cgi script...
#!/usr/local/bin/perl use GD; print "Content-type: text/plain","\n\n"; print "Welcome to my Web Server!", "\n"; $remote_host=$ENV{'REMOTE_HOST'}; print "You are visiting from", $remote_host, "."; my $gd = GD::Image->new(400,300); my$white = $gd->colorAllocate(255, 255, 255); my$black = $gd->colorAllocate(0, 0, 0); my$red = $gd->colorAllocate(255, 0, 0); my$green = $gd->colorAllocate(0, 255, 0); my$blue = $gd->colorAllocate(0, 0, 255); my$yellow = $gd->colorAllocate(255, 255, 0); gd->filledRectangle(0, 129, 199, 169, $blue); my $poly = GD::Polygon-new(); $poly->addPt(199, 149); $poly->addPt(399, 74); $poly->addPt(324, 149); $poly->addPt(399, 244); gd->filledPolygon($poly, $yellow); gd->polygon ($poly, $black); gd->arc(199, 149, 250, 250, 0, 360, $red); gd->arc(199, 100, 200, 250, 0, 360, $red); gd->fillToBorder(99, 149, $red, $green); gd->rectangle(0, 0, 399, 299, $red); gd->line(199, 0, 199, 299, $red); gd->line(0, 149, 399, 149, $red); exit(0);
The error...
Can't locate object method "filledRectangle" via package "gd" (perhaps + you forgot to load "gd"?) at /var/www/cgi-bin/GDtest.cgi line 22.
Am I barking up the wrong tree, or just plain barking mad?
janitored yb ybiC: Formatting clean-up using balanced <code> and <p> tags
In reply to httpd error_log (perhaps you forgot to load "gd"?) by Clunk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |