peterr

Well-Known Member
Sep 24, 2003
85
0
156
On a shared server, Perl version is 5.30.0, however it is only version 5.16.3 installed in the /home/..... path. Modules are also installed to the home path, Perl scripts state version 5.16.3, no matter how I have the "shebang" line configured. The following results from a terminal session

$ perl -v |grep version
This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi

$ /usr/local/cpanel/3rdparty/bin/perl -v |grep version
This is perl 5, version 30, subversion 0 (v5.30.0) built for x86_64-linux-64int

I notice that 'perl' is a symlink, which points to -> /usr/local/cpanel/3rdparty/perl/530/bin/perl

Is the resolve for this simply some sort of PATH configuration ??
 

peterr

Well-Known Member
Sep 24, 2003
85
0
156
Altering the "shebang" line made no difference (version number still shown as 5.16.3), yet altering the path in a command showed the system wide version (5.30.0), as follows:

Perl:
#!/usr/local/cpanel/3rdparty/bin/perl

# Available under BSD License.
# See url https://www.cyberciti.biz/faq/how-can-i-find-out-perl-version/

use strict;
my $command=` /usr/local/cpanel/3rdparty/perl/530/bin/perl -V`;
my $title = "Perl Version";

print "Content-type: text/html\n\n";
print "<html><head><title>$title</title></head><body>";

print "<h1>$title</h1>\n";

print '<hr>';
print $command;
print '</hr>';

print "</body></html>";
 

andrew.n

Well-Known Member
Jun 9, 2020
460
119
43
EU
cPanel Access Level
Root Administrator
cPanel for it's own use different PERL version than the system wide one as you see. It's like OpenSSL library or PHP versions. If you use a very simple script like this:

#!/usr/local/cpanel/3rdparty/bin/perl
my $perl_cmd = "/usr/local/cpanel/3rdparty/bin/perl --version";
my $perl_str=`$perl_cmd`;
print "PERL VERSION = " . $perl_str;

then you will see it prints the cPanel version while if you just use "/usr/bin/perl --version" that will print the system wide one.
 
  • Like
Reactions: peterr and cPRex

peterr

Well-Known Member
Sep 24, 2003
85
0
156
cPanel for it's own use different PERL version than the system wide one as you see. It's like OpenSSL library or PHP versions. If you use a very simple script like this:

#!/usr/local/cpanel/3rdparty/bin/perl
my $perl_cmd = "/usr/local/cpanel/3rdparty/bin/perl --version";
my $perl_str=`$perl_cmd`;
print "PERL VERSION = " . $perl_str;

then you will see it prints the cPanel version while if you just use "/usr/bin/perl --version" that will print the system wide one.
Thanks @andrew.n , yes same results as before, but different terminology. If I use

Perl:
my $command=` /usr/local/cpanel/3rdparty/bin/perl --version`;
the resultant display is
This is perl 5, version 30, subversion 0 (v5.30.0) built for x86_64-linux-64int (with 32 registered patches, see perl -V for more detail) Copyright 1987-2020, Larry Wall
If I use

Perl:
my $command= `/usr/bin/perl --version`;
the resultant display is
This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi (with 44 registered patches, see perl -V for more detail) Copyright 1987-2012, Larry Wall
Hmm, so you are calling 5.30.0 the CPanel version and 5.16.3 the system wide one. Okay...leading on ..

When I use the CPanel 'Install Perl modules' it is installing modules from 5.16.3 . Why I state that is because the modules are being installed in a /home/username path , and one such path I see there is /home/********/perl/usr/lib/perl5/5.16.3 , and that is why 5.16.3 shows as the version number from a
/usr/bin/perl --version
So, ...using your terminology, that is the system wide version, right ? How do I navigate around that to ensure I get the latest/CPanel version ?

From the minor research, it seems I would have to use bash/shell and install from CPAN that way ??
 

andrew.n

Well-Known Member
Jun 9, 2020
460
119
43
EU
cPanel Access Level
Root Administrator
that version of perl is only being utilised by cPanel and everything else is using the system wide version. I'm not really sure how good idea is to try to install additional modules/extensions to perl which is provided by cPanel and use that for whatever application you need but to answer your question you can find the modules under /usr/local/cpanel/3rdparty/bin/ folder so for example installing "imagick" can be done with /usr/local/cpanel/3rdparty/bin/pecl install imagick. In case of imagick it's also tricky as it can be installed under different PHP versions.

EDIT: yes there is cpan provided under /usr/local/cpanel/3rdparty/perl/530/bin/ so you have to use that to install additional modules under this perl version.

Please note that this is not supported by cPanel and not recommended either.
 
  • Like
Reactions: peterr

peterr

Well-Known Member
Sep 24, 2003
85
0
156
Please note that this is not supported by cPanel and not recommended either.
Thanks for the other explanations, as you have highlighted the above I won't proceed with doing that.

To take some information back to the hosting company support people, is the resolve for this to simply update the system wide Perl version so that it is the latest version ??. I use the term 'simply' lightly of course, as this is a shared server and potentially impacts other users. But even if other shared users are using Perl, I don't understand why they would want to be on a version that is well near 8 years old. Possibly scripts will break if a newer version is used ??

Thanks for all your help.
 

peterr

Well-Known Member
Sep 24, 2003
85
0
156
In checking various Perl modules and the versions, came across a nice script at MoDetails v0.2 ; very handy. (although it is old and uses CGI)