For cPanel & WHM 11.46
Which versions of Perl are compatible with cPanel?
cPanel & WHM servers include multiple Perl environments. Your version of cPanel & WHM determines the Perl environments that are available:
cPanel & WHM versions 62 and later include the following Perl environments:
Perl environment | Perl version | Location | Applications that use this Perl environment | Additional information |
---|---|---|---|---|
The server's Perl binary |
|
|
|
|
cPanel-included Perl installation | Perl 5.24 |
|
|
|
cPanel & WHM version 56 through 60 include the following Perl environments:
Perl environment | Perl version | Location | Applications that use this Perl environment | Additional information |
---|---|---|---|---|
The server's Perl binary |
|
|
|
|
cPanel-included Perl installation | Perl 5.22 |
|
|
|
cPanel & WHM versions 11.46 through 54 include the following Perl environments:
Perl environment | Perl version | Location | Applications that use this Perl environment | Additional information |
---|---|---|---|---|
The server's Perl binary |
|
|
|
|
cPanel-included Perl installation | Perl 5.14.4 |
|
|
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 environment | Perl version | Location | Applications that use this Perl environment | Additional information |
---|---|---|---|---|
The server's Perl binary |
|
|
|
|
cPanel's Perl binary | Perl 5.6.2 |
|
|
|
cPanel-included Perl installation | Perl 5.14.3 |
|
|
|
cPanel & WHM version 11.34 and earlier includes the following Perl environments:
Perl environment | Perl version | Location | Applications that use this Perl environment | Additional information |
---|---|---|---|---|
The server's Perl binary |
|
|
|
|
cPanel's Perl binary | Perl 5.6.2 |
|
|
|
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, this may be due to a code problem.
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 means that the Perl script will not 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 still 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 will not work in a browser even though it will work 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 su_exec to sanity test permissions
If the script still does not work in the browser, 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.
You will see output that is similar to 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 su_exec 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, you will see a result that resembles 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
This result means that the group file or password is corrupted.
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 will appear 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 su_exec 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 root return the "getgrgid: invalid groupid XXXXX" error?
The following 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 do 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 EasyApache.
- On the command line, run the
/scripts/easyapache
script as theroot
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.