Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question
1  
A quick apt-get install libgd-gd2-perl on my Squeeze box allowed me to use this example source to create a .PNG with Perl. Not sure about PHP. –  jscott Dec 23 '11 at 1: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 1: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 2: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 2: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 2:59

1 Answer 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
share|improve this answer
    
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 4 '12 at 21:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.