Fatal library errors on cgi files

Greetings,

I’m getting the following error on any cgi page.
[Wed Mar 18 14:47:01 2009] [error] [client x.x.x.x] ld.so.1: statusmap.cgi: fatal: libgd.so.2: open failed: No such file or directory, referer: myhost/nagios/side.html
[Wed Mar 18 14:47:01 2009] [error] [client x.x.x.x] Premature end of script headers: statusmap.cgi, referer: myhost/nagios/side.html

I compiled in support for all of the llibrary files (at least i’m pretty sure i did).
When i run ldd on the cgi file it finds all the librarys it wants.

ldd statusmap.cgi

    libgd.so.2 =>    /usr/local/lib/libgd.so.2
    libiconv.so.2 =>         /usr/local/lib/libiconv.so.2
    libpng12.so.0 =>         /usr/local/lib/libpng12.so.0
    libjpeg.so.62 =>         /usr/local/lib/libjpeg.so.62
    libz.so =>       /usr/lib/libz.so
    libm.so.2 =>     /usr/lib/libm.so.2
    librt.so.1 =>    /usr/lib/librt.so.1
    libglib-2.0.so.0 =>      /usr/local/lib/libglib-2.0.so.0
    libc.so.1 =>     /usr/lib/libc.so.1
    libXpm.so.4.11 =>        /usr/lib/libXpm.so.4.11
    libX11.so.4 =>   /usr/lib/libX11.so.4
    libfontconfig.so.1 =>    /usr/lib/libfontconfig.so.1
    libfreetype.so.6 =>      /usr/local/lib/libfreetype.so.6
    libgcc_s.so.1 =>         /usr/local/lib/libgcc_s.so.1
    libaio.so.1 =>   /usr/lib/libaio.so.1
    libmd.so.1 =>    /usr/lib/libmd.so.1
    libXext.so.0 =>  /usr/lib/libXext.so.0
    libsocket.so.1 =>        /usr/lib/libsocket.so.1
    libnsl.so.1 =>   /usr/lib/libnsl.so.1
    libdl.so.1 =>    /usr/lib/libdl.so.1
    libexpat.so.0 =>         /usr/local/lib/libexpat.so.0
    libmp.so.2 =>    /usr/lib/libmp.so.2
    libscf.so.1 =>   /usr/lib/libscf.so.1
    libdoor.so.1 =>  /usr/lib/libdoor.so.1
    libuutil.so.1 =>         /usr/lib/libuutil.so.1
    libgen.so.1 =>   /usr/lib/libgen.so.1
    /platform/SUNW,Sun-Fire-V245/lib/libc_psr.so.1
    /platform/SUNW,Sun-Fire-V245/lib/libmd_psr.so.1

What else should i be looking for?

Regards,
Brian F.