-1

I have already successfully installed the Perl module Crypt::CBC on cPanel. But when adding the line "use Crypt::CBC;" I am getting the error:

Can't locate Crypt/CBC.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at sagepay.pl line 128. BEGIN failed--compilation aborted at sagepay.pl line 128.

Did I miss something? Quite new to Perl modules installation.

john
  • 93
  • 9
  • Please [edit] the full error message into your question. – ThisSuitIsBlackNot Feb 25 '16 at 15:09
  • Just edited it. Thanks! – john Feb 25 '16 at 15:13
  • 1
    That error message has nothing to do with the module being installed or not. It means that something is trying to access the image file comsys_w.gif, but it doesn't exist at that location. – ThisSuitIsBlackNot Feb 25 '16 at 15:15
  • Yup sorry my bad! Those 404 images are from the custom error page. The actual error when I am adding "use Crypt::CBC;" is not being logged at all. – john Feb 25 '16 at 15:22
  • 1
    It most likely is being logged, but it might be going to a different log file. Add `use CGI::Carp qw(fatalsToBrowser);` to the top of your script and fatal errors should be reported in your browser when you access the page. – ThisSuitIsBlackNot Feb 25 '16 at 15:28
  • Finally got the error now, updated the question! How come it cannot locate the file that was already installed? Thanks! – john Feb 25 '16 at 15:50
  • Where did you install Crypt::CBC? Are you sure the installation was successful? What command did you run to install it? – ThisSuitIsBlackNot Feb 25 '16 at 15:55
  • I installed it through the cPanel web portal. Yes it did installed successfully and appears on the Installed Modules list. I did try to add "use lib '/data01/c1501978/perl';" because it is the Module Include Path but still cannot locate. – john Feb 25 '16 at 16:01
  • @john: What command did you run to install the module? – Borodin Feb 25 '16 at 16:09
  • @Borodin: I installed it through cPanel's web portal, I did not used any linux command. – john Feb 25 '16 at 16:15
  • `/data01/c1501978/perl` was NOT added, as you can see in by its absense from the error message. First of all, what's the output of `find /data01/c1501978/perl -name CBC.pm` – ikegami Feb 25 '16 at 16:51

3 Answers3

1

check the value of @INC by running this using your web server:

 perl -e 'print "Content-type: text/plain\r\n\r\n" . join(":",@INC);'

@INC is where perl looks for modules. Perhaps they got installed in the wrong location. You can add new locations with perl's -I option (see "man perlrun" for details)

neuhaus
  • 3,886
  • 1
  • 10
  • 27
  • Check the value on shell right? Sorry I am new to this. I only have cPanel access. cPanel says "Module Include Path: /data01/c1501978/perl" – john Feb 25 '16 at 14:35
  • No, if you `print "Content-type: text/plain\n\n";` before the print I gave earlier you can run it as a CGI to see what `@INC` contains when your script is executed using the webserver. – neuhaus Feb 25 '16 at 14:38
  • Thanks! Got this: /data01/c1501978/perl /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 It should work right since cPanel says that "/data01/c1501978/perl" is the Module Include Path? – john Feb 25 '16 at 14:58
1

I suspect that you may have added the module to cPanel instead of to the system Perl, for which you need to use WHM. Take a look at these instructions and follow the directions headed Install modules to the system Perl binary

Borodin
  • 126,100
  • 9
  • 70
  • 144
  • I already installed it on WHM "Software & Services > Perl Modules". I checked and saw the file on "perl/usr/lib/perl5/Crypt". Correct right? – john Feb 25 '16 at 16:29
  • @john: I'm not sure about the `perl` at the start. Do you mean `/usr/lib/perl5/Crypt`, so you have a file `/usr/lib/perl5/Crypt/CBC.pm`? – Borodin Feb 25 '16 at 16:48
  • I have this on the path of the file manager "/perl/usr/lib/perl5/Crypt/CBC.pm". – john Feb 25 '16 at 16:54
  • @john: That's a strange path, but you should be able to get it working if you add `use lib '/perl/usr/lib/perl5'` before your `use Crypt::CBC`. Is there also a `/data01/c1501978/perl/Crypt/CBC.pm`? – Borodin Feb 25 '16 at 16:57
  • Hi guys this is already resolved. Thanks for the help! See answer below. – john Mar 03 '16 at 08:57
0

Thanks everyone! Just a wrong path, I used this and it now works:

use lib '/data01/c1501978/perl/usr/lib/perl5';

john
  • 93
  • 9