Add image support to GD on Debian

aptdebian-squeezegdphp5-gd

I've recently replaced our aging (386) monitoring machine with something a bit more recent and because I had driver issues with CentOS I decided to use Debian 6 (Squeeze) instead. While in the past I've preferred to compile from source this time I thought I'd try to stick with apt and install packages that way.

I suppose it was inevitable that there are issues. Of main concern is that there appears to be no image support in GD with error messages such as this whenever I try to create an image in code (PHP or Perl):

 Can't locate object method "png" via package "GD::Image"

I can replace "png" with "jpg" or "gif", all result in the same error.

I can't locate any packages which look like they might add the needed graphic support. How can I resolve this without creating a dependency hell for myself?

EDIT

Based on the various comments below I've come to the conclusion that something is screwed with at least part of my GD installation, so the question now becomes: How can I uninstall the various parts and reinstall them without causing myself any more problems than I already have? Sadly, I'm not in a position to wipe this machine and start over.

Now I remember why I've previously stayed away from these package managers and the dependency nightmares they create. 🙁

Best Answer

Perl looks for modules in the directories of the @INC array, just like Bash does with $PATH for commands. The GD installed by apt is probably being overridden by something else in the @INC.

Look for files named GD.pm in your system, it should show only the Debian one in /usr/lib/perl5/GD.pm.

You can check your @INC using perl -e 'print join "\n", @INC', mine is

/etc/perl
/usr/local/lib/perl/5.10.1
/usr/local/share/perl/5.10.1
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.10
/usr/share/perl/5.10
/usr/local/lib/site_perl
Related Topic