nootkan

Well-Known Member
Oct 25, 2006
170
12
168
Apologize if this is the wrong forum. I have an older perl script that has been running fine until awhile ago when I noticed this error:
fatal error: Can't locate GD.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at admin/captcha/captcha.pl line 42.
BEGIN failed--compilation aborted at admin/captcha/captcha.pl line 42.
Compilation failed in require at /home/mywebsite/public_html/links/cgi-bin/admin/db_utils.pl line 629.
I've been researching this error for days and have yet to find an explanation or solution to my problem.


I've looked inside the captcha.pl at line 42 and admin/db_utils.pl at line 629 but can't see anything to point me in the right direction.

Code:
//line 42
use GD;
Code:
//line 629
require "admin/captcha/captcha.pl";  # This should be the path from add.cgi
path in add.cgi is the same as db_utils.pl

Looked in the usr/local and usr/lib64 and usr/share folders/files and confirm that GD isn't there.

So I thought maybe GD was missing from the server but it is there.

# php -i | grep 'GD\|ImageMagick'
GD Support => enabled
GD Version => bundled (2.1.0 compatible)
I've also installed ImageMagick to see if that would fix it but still the same.

I am not too familiar with perl so I thought I'd reach out here to someone who may be able to give me some direction on where I should be looking.


Here are my server details:

CENTOS 7.9
cPanel V94.0.4
Apache Version 2.4.46
PHP Version PHP 5.6 ( ea-php56 )
MySQL Version 5.7.33
Architecture x86_64
Operating System linux
Path to Perl /usr/bin/perl
Perl Version 5.16.3
Kernel Version 3.10.0-1127.18.2.el7.x86_64
 
Last edited by a moderator:

cPAdminsMichael

Well-Known Member
Dec 19, 2016
186
67
153
Denmark
cPanel Access Level
Root Administrator
Hi,

So - you get the error in a perl script and test that GD is installed in PHP? :) :)
You may want to check if perl-GD is installed: rpm -q perl-GD
 
  • Like
Reactions: nootkan

nootkan

Well-Known Member
Oct 25, 2006
170
12
168
Thanks for the replies. I didn't realize that GD had to be installed for every language. I thought they came installed with the package. I found this command to install perl-GD.
yum install perl-GD
 
Last edited:

nootkan

Well-Known Member
Oct 25, 2006
170
12
168
Another question if that is alright. Is GD.pm the same as the GD library I just installed using the yum command? It is a little confusing as to whether it is a different module or .pm is the file name for GD. Thanks
 

nootkan

Well-Known Member
Oct 25, 2006
170
12
168
cPRex, thanks for your reply. I figured that when running the yum command that GD.pm was installed but wanted to make sure as it seems there are a lot of modules for perl.
 
  • Like
Reactions: cPRex

nootkan

Well-Known Member
Oct 25, 2006
170
12
168
sorry inadventantly posted the same reply as earlier and couldn't find a way to delete it.
 

nootkan

Well-Known Member
Oct 25, 2006
170
12
168
Okay after installing perl GD.pm and trying to get the captcha mod working I got this error:
fatal error: source is not of type GD::Image at admin/captcha/captcha.pl line 162
After some research I determined that GD::Image is a module so I ran the following two commands:
# rpm -q perl-GD::Image
package perl-GD::Image is not installed

# yum install perl-GD::Image
Loaded plugins: fastestmirror, universal-hooks
Loading mirror speeds from cached hostfile
* EA4: 204.10.37.146
* cpanel-addons-production-feed: 204.10.37.146
* cpanel-plugins: 204.10.37.146
* base: mirror.esecuredata.com
* extras: centos.mirror.netelligent.ca
* updates: centos.ca-west.mirror.fullhost.io
No package perl-GD::Image available.
Error: Nothing to do
So I did some more research and ran this command:
cpan GD::Image
Which ran for quite a while prompting me to say yes or no to two temp installs named extUtils-config1.16 and MSCHWERN/Test-fork-0.02. After all was said and done I didn't get any errors and when I tried to run the rpm -q command again I got the same result
rpm -q perl-GD::Image
package perl-GD::Image is not installed
What did I install if it wasn't GD::Image?

Update: When I visited usr/local/lib64/perl5/GD/ image.pm is there. I guess that the rpm command isn't the right one to confirm GD::Image is installed on a centos 7 server. Also it looks like the previous command cpan GD::Image installed about 3-4 modules besides the image.pm module
 
Last edited:
  • Like
Reactions: cPRex