Page tree
Skip to end of metadata
Go to start of metadata

 

For cPanel & WHM version 11.50

Which versions of Perl are compatible with cPanel & WHM?

cPanel & WHM servers include multiple Perl environments.

Your version of cPanel & WHM determines which Perl environments are available:


 cPanel & WHM versions 62 and later include the following Perl environments:

Perl environmentPerl versionLocationApplications that use this Perl environmentAdditional information
The server's Perl binary
  • Perl 5.8.8 on CentOS, CloudLinux™, and Red Hat® Enterprise Linux (RHEL) 5 (cPanel & WHM version 56 only).
  • Perl 5.10 on CentOS, CloudLinux, and RHEL 6, and Amazon® Linux.
  • Perl 5.16 on CentOS, CloudLinux, and RHEL 7.

/usr/bin/perl

  • Operating system maintenance scripts.

  • Some custom modules.
  • Manage modules for this Perl environment with the cpan command or with WHM's Module Installers interface (WHM >> Home >> Software >> Module Installers).
cPanel-included Perl installationPerl 5.24
  • This environment self-embeds and compiles in the cPanel binary.

  • /usr/local/cpanel/3rdparty/bin/perl

    Note:

    This location is a symlink.

  • Install custom modules for this Perl environment into the /opt/cpanel/perl5/524/site_lib directory.

    Note:

    @INC walks this directory after it walks all other directories for modules.

  • The cPanel & WHM software.
  • cPanel system maintenance scripts (in the /usr/local/cpanel/scripts directory).
  • CGI scripts.

  • This environment allows you to manage the system's Perl binary independently from cPanel & WHM. Use it when you write Perl scripts for a cPanel & WHM server.
  • For more information about how to modify scripts and modules to use this Perl environment, read our Prepare Perl Scripts for cPanel & WHM's Internal Perl documentation.

 cPanel & WHM version 56 through 60 include the following Perl environments:

Perl environmentPerl versionLocationApplications that use this Perl environmentAdditional information
The server's Perl binary
  • Perl 5.8.8 on CentOS, CloudLinux™, and Red Hat® Enterprise Linux (RHEL) 5 (cPanel & WHM version 56 only).
  • Perl 5.10 on CentOS, CloudLinux, and RHEL 6, and Amazon Linux.
  • Perl 5.16 on CentOS, CloudLinux, and RHEL 7.

/usr/bin/perl

  • Operating system maintenance scripts.

  • Some custom modules.
  • Manage modules for this Perl environment with the cpan command or with WHM's Module Installers interface (WHM >> Home >> Software >> Module Installers).
cPanel-included Perl installationPerl 5.22
  • This environment self-embeds and compiles in the cPanel binary.

  • /usr/local/cpanel/3rdparty/bin/perl

    Note:

    This location is a symlink.

  • Install custom modules for this Perl environment into the /opt/cpanel/perl5/522/site_lib directory.

    Note:

    @INC walks this directory after it walks all other directories for modules.

  • The cPanel & WHM software.
  • cPanel system maintenance scripts (in the /usr/local/cpanel/scripts directory).
  • CGI scripts.

  • This environment allows you to manage the system's Perl binary independently from cPanel & WHM. Use it when you write Perl scripts for a cPanel & WHM server.
  • For more information about how to modify scripts and modules to use this Perl environment, read our Prepare Perl Scripts for cPanel & WHM's Internal Perl documentation.

 cPanel & WHM versions 11.46 through 54 include the following Perl environments:

Perl environmentPerl versionLocationApplications that use this Perl environmentAdditional information
The server's Perl binary
  • Perl 5.8.8 on CentOS, CloudLinux™, and Red Hat® Enterprise Linux (RHEL) 5.
  • Perl 5.10 on CentOS, CloudLinux, and RHEL 6, and Amazon Linux.
  • Perl 5.16 on CentOS, CloudLinux, and RHEL 7.

/usr/bin/perl

  • Operating system maintenance scripts

  • Some custom modules
  • Manage modules for this Perl environment with the cpan command or with WHM's Module Installers interface (WHM >> Home >> Software >> Module Installers).
cPanel-included Perl installationPerl 5.14.4
  • This environment self-embeds and compiles in the cPanel binary.

  • /usr/local/cpanel/3rdparty/bin/perl

    Note:

    This location is a symlink.

  • Install custom modules for this Perl environment into the /opt/cpanel/perl5/514/site_lib directory.

    Note:

    @INC walks this directory after it walks all other directories for modules.

  • The cPanel & WHM software.
  • cPanel system maintenance scripts (in the /usr/local/cpanel/scripts directory).
  • CGI scripts

  • This environment allows you to manage the system's Perl binary independently from cPanel & WHM. Use it when you write Perl scripts for a cPanel & WHM server.
  • For more information about how to modify scripts and modules to use this Perl environment, read our Prepare Perl Scripts for cPanel & WHM's Internal Perl documentation.

Note:

In cPanel & WHM version 11.46 and later, cPanel's Perl binary and the cPanel-included Perl installation use the same modules and have the same Perl version. 

cPanel & WHM version 11.36 through 11.44 includes the following Perl environments:

Perl environmentPerl versionLocationApplications that use this Perl environmentAdditional information
The server's Perl binary
  • Perl 5.8.8 on CentOS, CloudLinux™, and Red Hat® Enterprise Linux (RHEL) 5.
  • Perl 5.10 on CentOS, CloudLinux, and RHEL 6.

/usr/bin/perl

  • Operating system maintenance scripts

  • Some custom modules
  • Manage modules for this Perl environment with the cpan command or with WHM's Module Installers interface (WHM >> Home >> Software >> Module Installers).
cPanel's Perl binaryPerl 5.6.2
  • This environment self-embeds and compiles in the cPanel binary.
  • Place modules for this Perl environment into the /usr/local/cpanel/perl directory.
  • The cPanel & WHM software.
  • Some custom modules

 

cPanel-included Perl installationPerl 5.14.3
  • /usr/local/cpanel/3rdparty/bin/perl

    Note:

    This location is a symlink.

  • Install custom modules for this Perl environment into the /usr/local/cpanel/3rdparty/perl/514/site-lib directory.
  • cPanel system maintenance scripts (in the /usr/local/cpanel/scripts directory).
  • CGI scripts

  • This environment allows you to manage your system's Perl binary independently from cPanel & WHM. Use it when you write Perl scripts for your cPanel & WHM server.
  • For more information about how to modify scripts and modules to use this Perl environment, read our Prepare Perl Scripts for cPanel & WHM's Internal Perl documentation.

cPanel & WHM version 11.34 and earlier includes the following Perl environments:

Perl environmentPerl versionLocationApplications that use this Perl environmentAdditional information
The server's Perl binary
  • Perl 5.8.8 on CentOS, CloudLinux™, and Red Hat® Enterprise Linux (RHEL) 5.
  • Perl 5.10 on CentOS, CloudLinux, and RHEL 6.

/usr/bin/perl

  • Operating system maintenance scripts
  • cPanel system maintenance scripts (in the /usr/local/cpanel/scripts directory).
  • CGI scripts

  • Manage modules for this Perl environment with the cpan command or with WHM's Module Installers interface (WHM >> Home >> Software >> Module Installers).
  • cPanel & WHM excludes this environment in YUM updates.
cPanel's Perl binaryPerl 5.6.2
  • This environment self-embeds and compiles in the cPanel binary.
  • Place modules for this Perl environment into the /usr/local/cpanel/perl directory.
  • The cPanel & WHM software.
  • Custom modules

 

How can I install a Perl Module?

For directions to install a Perl module, read our Perl Module Installation documentation.

What is wrong with my CGI and Perl scripts?

Problems with CGI and Perl scripts are common, and may be due to a wide variety of reasons.

To troubleshoot the problem, use the following methods. The following examples troubleshoot the example.cgi script.

Check the script permissions

First, make certain that the script is executable. To display the permissions for a script, run the ls -la example.cgi command, where example.cgi is the name of the script, as the root user:

# ls -al
total 6
drwxr-xr-x 2 burst wheel 512 May 29 16:04 .
drwxr-xr-x 3 burst wheel 512 May 29 16:03 ..
-rw-r--r-- 1 burst wheel 41 May 29 16:04 example.cgi

In this example, the script has the following permissions:

  • The script is readable by everyone.
  • The script is writable only by the owner.
  • The script is not executable by anyone.

To change the permissions of the script, run the following command:

chmod 755 example.cgi

This command changes the permissions of the script to the following permissions:

  • The script is readable by everyone.
  • The script is executable by everyone.
  • The script is writable only by the owner.

Check the script code for issues

If the server still returns a 500 error, a code error may be the reason.

To check the code for errors, run the following command:

perl -w ./example.cgi

This command turns on warnings, which indicate any errors in the code:

# perl -w ./example.cgi
Can't find string terminator '"' anywhere before EOF at ./example.cgi line 3.

This message indicates that the Perl script cannot run because it contains fatal errors.

Note:

Search online for tutorials on Perl and how to troubleshoot specific errors.

Add a content type to the script

If you found the error within the code, run the script from the command line again:

# perl -w ./example.cgi
Hello World !

If the script works at the command line but does not work in a browser, the script may not send the correct content type to the browser.

In the above example, the example.cgi script cannot function correctly in a browser even though it works from the shell. To fix this problem, add the following line near the top of the script:

print "Content-type: text/html\n\n";

 

When you run the script, you will see the following:

# perl -w ./example.cgi
Content-type: text/html
Hello World !

Use the su_exec module to sanity test permissions

If the script does not work in the browser with the correct content type, the su_exec module may cause the problem. The Apache webserver often includes the su_exec module as a security measure. It forces a sanity test on the permissions of CGI scripts before it runs them. A sanity test checks the permissions of scripts and determines whether they are accessible.

After the su_exec module completes the sanity test, it forces the scripts to run with the permissions of the account owner.

When you check for proper permissions, run the ls-la command.

The output will resemble the following example:

# ls -la
total 6
drwxr-xr-x 2 burst wheel 512 May 29 16:04 .
drwxr-xr-x 3 burst wheel 512 May 29 16:03 ..
-rwxr-xr-x 1 burst wheel 78 May 29 16:24 example.cgi

The directory "." is the current working directory. Set this directory to the following permissions:

  • The script is readable by everyone.
  • The script is executable by everyone.
  • The script is writable only by the owner.

If you are unsure about problems with a script, examine the su_exec log file in the /usr/local/apache/logs/ directory. Use the tail -f suexec_log command to watch the log file, and then try to load the script in your browser to see the error that the script caused.

Use the su_exec module to sanity check ownership

Confirm that the account's user owns the file. Sometimes, when a password or group file becomes corrupted, you will see a number rather than a username.

When you run the ls-la command and a file is corrupted, the output will resemble the following example:

# ls -la
total 6
drwxr-xr-x 2 8840 8840 512 May 29 16:04 .
drwxr-xr-x 3 burst wheel 512 May 29 16:03 ..
-rwxr-xr-x 1 8840 8840 78 May 29 16:24 example.cgi

To fix this error, run the chown burst.burst * command to change the script and the directory back to the correct owner.

Even if the owner appears to be correct, it is possible for a script to have the correct name but to actually be associated with a different user ID. This issue appears in the suexec_log file. 

If you have performed all of these steps and the script still does not work, submit a support ticket.

How do I write JavaScript code on my website?

Search for a tutorial on JavaScript. JavaScript is a language that has many rules and conventions. Because of this, it may take some time to learn.

When you are ready to add your code, edit your HTML files directly to add JavaScript code with a text editor. You can also edit them through cPanel's File Manager interface (Home >> Files >> File Manager).

What if the su_exec module breaks my CGI scripts?

If the su_exec module breaks your CGI scripts, run the tail- command on the /usr/local/apache/logs/suexec_log log file to find the error.

How can I troubleshoot Perl or CGI scripts?

To troubleshoot Perl or CGI scripts, add the following code to the top of your script:

#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);

This change redirects errors to the browser and does not display a 500 error.

You can also use the following command to check whether the script runs on the command line and check for errors:

perl -w ./scriptname.cgi

What if all Perl or CGI scripts that do not run as the root user return the "getgrgid: invalid groupid XXXXX" error?

The following output is an example of error output from a Perl script that is found in Apache's error log (/usr/local/apache/logs/error_log) :

[Tue Mar 26 09:13:16 2002] [error] [client x.x.x.x] (2)No such file or directory: getgrgid: invalid groupid 32015
[Tue Mar 26 09:13:16 2002] [error] (2)No such file or directory: exec of /home/username/public_html/utility.cgi failed
[Tue Mar 26 09:13:16 2002] [error] [client x.x.x.x] Premature end of script headers: /home/username/public_html/script.cgi

To fix this error, run the following command:

chmod 644 /etc/group

If you continue to experience an issue, check the permissions on the passwd file and shadow file as well.

If that fails to fix the issue, submit a support ticket.

Can I run PHP 4 and PHP 5 at the same time?

No. cPanel & WHM does not support PHP 4.

How can I upgrade from PHP 4 to PHP 5, and what changes must I make?

To upgrade from PHP4 to PHP5 during the Apache build process, use one of the following methods: 

  • Start the Apache build process in EA.
  • On the command line, run the /scripts/easyapache script as the root user. 

Note:

Make certain that the PHP programs and scripts that you wish to run are compatible with PHP 5.

How do I upgrade the system Perl?

We recommend that you allow your operating system's distribution to control the system Perl installation.

How do I activate or install Zend Optimizer?

To install and activate Zend Optimizer, run the /scripts/installzendopt script at the command line as the root user.

Note:

Zend Optimizer does not work with the PHP debugger. 

If I enabled suPHP, how can I override the default settings in the php.ini file?

Because the PHP module does not have control over the httpd.conf or .htaccess files, place a customized php.ini file in the directory that contains your PHP scripts.

How can I add my own module for cPanel & WHM?

For more information about how to install modules to cPanel & WHM, read our Perl Module Installation documentation.