How To Install PHP 5.2 on cPanel/WHM 11.40+

cPanel, Inc. has released EasyApache 3.24. This version removes Apache 1.3/2.0, PHP 5.2, and mod_frontpage. As mentioned in
Introducing EasyApachea Optimal Profiles, These End of Life (EOL) items are no longer available in EasyApache.

These items have been removed for the following reasons:

  • They are no longer supported by their respective developers.
  • They include unpatched CVEs (Common Vulnerabilities and Exposures).
  • EasyApache provides the most up-to-date, supported versions of Apache (2.2/2.4) and PHP (5.4/5.5).

Keep in mind that viable alternatives to mod_frontpage exist, such as WebDAV and FTP. Also, PHP 5.2 and mod_frontpage are available as custom modules (“opt mods”).

You can read more about how to use and install Custom Modules at :

Downgrading PHP version is not a good idea.We always suggest you to use latest updates version of software/Scripts you are using.In new cPanel version they have completely dropped support for PHP version 5.2 .If you PHP is corrupted or need to recompile it for some reason then you can’t rebuild your old PHP version using EasyApache (3.24) .So you may have to do it at custom.You can do this by following the steps given below.

Install Dependencies using ‘YUM’

# yum install libcurl-devel libmcrypt libmcrypt-devel aspell aspell-devel tidy libtidy libtidy-devel libxslt libxslt-devel 

# cd /var/cpanel/easy/apache/custom_opt_mods/

# wget

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

# nano /var/cpanel/easy/apache/rawopts/all_php5



You can enable all relevant PHP modules in “/var/cpanel/easy/apache/rawopts/all_php5”.

Then recompile Apache using “/scripts/easyapache”. Go to step 3 “Please choose which specific PHP version(s) to build”
If you want no PHP except 5.2 then on the “PHP Version” screen chose “None” and continue to step 4, The “Short Options List” page you will see “PHP 5.2.17 support (no FastCGI)” listed. Check that box and continue your EasyApache like normal.

After EasyApache you can re-install IonCubeLoader and Zendopt using :

# /scripts/phpextensionmgr install IonCubeLoader
# /scripts/phpextensionmgr install Zendopt

You can install the following PHP extensions using script ‘/scripts/phpextensionmgr’

  • EAccelerator
  • IonCubeLoader
  • Zendopt
  • Xcache
  • SourceGuardian
  • PHPSuHosin

If necessary you can install other missing PHP modules without doing Easyapache.You can do this simply by login into the server as root :

# cd /home/cpeasyapache/src/php-5.2.17/ext/mcrypt/  (Go to particular extension folder,Here I need to install Mcrypt)

# phpize
# ./configure
# make
# make install

After that you can see extension directory path:

# php -i | grep extension_dir

# ls -al  /usr/local/lib/php/extensions/no-debug-non-zts-20060613/
# vi /usr/local/lib/php.ini

add extension=”” .Then restart apache using :

# /etc/init.d/httpd restart

Other method is:

# wget -O /usr/local/src/tidy-1.2.tgz
# cd /usr/local/src/
# tar zxvf tidy-1.2.tgz
# cd tidy-1.2
# phpize
# ./configure
# make
# make install
# php -i | grep extension_dir
# ls -al  /usr/local/lib/php/extensions/no-debug-non-zts-20060613/
# vi /usr/local/lib/php.ini

add extension=”” extension under your extension directory path and restart apache using:

# /etc/init.d/httpd restart

That’s it !