4

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. :(

John Gardeniers
  • 27,262
  • 12
  • 53
  • 108
  • 1
    A quick [`apt-get install libgd-gd2-perl`](http://packages.debian.org/squeeze/perl/libgd-gd2-perl) on my Squeeze box allowed me to use [this example source](http://www.emunix.emich.edu/~evett/BioinformaticsTools/Mastering%20Perl/gd.pl) to create a .PNG with Perl. Not sure about PHP. – jscott Dec 23 '11 at 01:03
  • The default php5-gd library seems to create png image files for me without any problems. Are you sure that php5-dg got loaded properly? Are you sure there isn't some kind of bug in the script/program trying to use it? – Zoredache Dec 23 '11 at 01:50
  • @jscott, I have `libgd-gd2-perl` installed and rechecked with your sample code (very similar to what I was already trying) and still get the same error. – John Gardeniers Dec 23 '11 at 02:10
  • @Zoredache, I even tried uninstalling `php5-gd`, rebooting (just to be sure) and reinstalling it (and restarting Apache). Testing this time with jscott's sample code. Still no go. – John Gardeniers Dec 23 '11 at 02:13
  • FWIW I don't have `php5-gd` installed. Without `libgd-gd2-perl`, I get `Can't locate GD.pm in @INC` trying to use the sample. – jscott Dec 23 '11 at 02:59
  • I use gd with php on squeeze without problems at all. installed `libgd2-xpm` and `php5-gd` ... works like a charm :-) – Mathias R. Jessen Dec 28 '11 at 00:02
  • Are you sure that the libpng12-0 package is really installed ? – Dom Dec 29 '11 at 09:51
  • @Dom, when I try to install libpng12-0 I get "libpng12-0 is already the newest version". – John Gardeniers Dec 29 '11 at 20:54
  • Do you see something in general logs ? Is there SELinux active ? Really strange, it works really well on our 10 servers without problem ! – Dom Dec 30 '11 at 08:32
  • @Dom, nothing in the general logs and SELinux is not even installed, not that it should have the effect being observed. – John Gardeniers Jan 04 '12 at 21:23

1 Answers1

1

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
S19N
  • 1,693
  • 1
  • 17
  • 28
  • GD.pm is within the @INC path but this wouldn't have an effect on PHP and the question quite clearly states "whenever I try to create an image in code (PHP or Perl)". – John Gardeniers Jan 04 '12 at 21:17