How to install PHP 5.2 in the latest cPanel Server?

In this documentation we can check how to install PHP 5.2 in latest cPanel Server.

Before we start, let us warn you that it is not recommended to run older, depreciated PHP versions in a production server. It will cause lot of security issues. You may need this version for some old applications or custom programs. However, if you decide to take this course of action you are responsible for the risk you take. We do not support this issue.

If you are running the latest cPanel, you won’t be able to find the option to install PHP 5.2 in EasyApache. Please note that, this is something that cPanel don’t support. We need to install it as a “option modules” referred to as an “opt mod” for short.

There are two custom opt mod available for PHP 5.2. Normal PHP 5.2 and PHP5.2 with FCGI.

You need to first decide which version suits you well.

If you are installing normal PHP 5.2, follow the steps below.

wget https://documentation.cpanel.net/download/attachments/2326651/custom_opt_mod-PHP5217update.tar.gz

tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf custom_opt_mod-PHP5217update.tar.gz

If you are installing PHP5.2 with FCGI, then follow the steps below.

wget https://documentation.cpanel.net/download/attachments/2326651/custom_opt_mod-PHP5217update-fastcgi.tar.gz

tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf custom_opt_mod-PHP5217update-fastcgi.tar.gz

Now the PHP 5.2 opt mode is added to EasyApache script. You need to run EasyApache script and compile it with PHP 5.2

WHM -> Software -> EasyApache 3 -> Start customizing based on profile -> Check ‘PHP 5.2’ option  -> Save and Build

You can do the same by running “/scripts/easyapache” from command line.

Wait for the EasyApache to complete the compilation. Then check the PHP version by running “PHP -v” command in your shell. It will show PHP 5.2

Note:
If you have problems when you build Apache with custom modules, run the /scripts/easyapache –skip-custom-optmods command. (You can also execute this command from the EasyApache Help section in WHM.) This command causes EasyApache to build Apache and PHP without any custom modules. If Apache and PHP build cleanly without the custom modules, then you need to correct or omit the custom modules.

If you need any further help, please contact our support department. Our support is available 24×7 via ticket, chat, and phone.

Was this answer helpful? 0 Users Found This Useful (0 Votes)