Friends, I got a chance for installing PHP 5.6 and PHP 5.5 together in Directadmin, where PHP 5.6 should be the default and it should be in CGI mode with suPHP installation and PHP 5.5 should be the secondary and it should be run with CLI (mod_php).
May be a niche post but after some fighting with my virtual server running CentOS 5 it boiled down to a really simple solution.

First of all check the version of custombuild in your Directadmin.
Using Custombuild we can install PHP with suPHP, all versions of PHP (4,5,6), Pure-FTPd, SpamAssassin, ClamAV, ProFTPD, MySQL, Exim, RoundCube webmail, Atmail lite webmail, and so on. It has an options file, which allows you to use 2 copies of PHP, choose Apache 2.0 or 2.2, option to rewrite all configs if they got damaged etc. It can also show (./build versions) or update all needed software with only 1 command (./build update_versions).

root@tig01 custombuild]#cd /usr/local/directadmin/custombuild/
[root@tig01 custombuild]#./build version

If it is not version 2.0, Please update the custombuild to the latest version (2.0)
++++++++++++++++++++++++++++++++++++++++++++++++++++++

Download latest version of custombuild 2.0
[root@tig01 custombuild]# cd /usr/local/directadmin
[root@tig01 custombuild]# mv custombuild custombuild-01
[root@tig01 custombuild]# wget http://files.directadmin.com/services/custombuild/2.0/custombuild.tar.gz
[root@tig01 custombuild]# tar xvzf custombuild.tar.gz
[root@tig01 custombuild]# cd custombuild
[root@tig01 custombuild]# ./build d

Setup options.conf file
++++++++++++++++

Change the following entries in the options.conf file as
[root@tig01 custombuild]#vi options.conf
———————-
php1_release=5.6
php1_mode=suphp
php2_release=5.5
php2_mode=mod_php
—————————-
You can change the entries as your like, but remember don’t set both CLI and CGI of the same PHP version to โ€œyes”
After the changes every time run.
[root@tig01 custombuild]# ./build php
or
[root@tig01 custombuild]# ./build update_data

You can verify this by running the command
[root@tig01 custombuild]# ./build options
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apache: 2.4.10
mod_ruid2: 0.9.8
Dovecot: 2.2.13
AWstats: no
Exim: no
exim.conf update: no
SpamAssassin: no
ClamAV: no
MySQL: no
MySQL backup: yes
MySQL backup directory: /usr/local/directadmin/custombuild/mysql_backups
PHP (default): 5.6 as suphp
PHP (additional): 5.5 as mod_php
phpMyAdmin: 4.2.9-all-languages
ProFTPD: no
Pure-FTPd: 1.0.36
RoundCube webmail: 1.0.3
Replace “php.ini” with ‘./build all’ and ‘./build php_ini’: no
Auto updates/notifications: no
Run “clean” every time: yes
Run “clean_old_webapps” every time: yes
Run “clean_old_tarballs” every time: yes
Show texts in bold: yes
SquirrelMail: 1.4.22-20140402_0200
Zend Guard Loader: no
ionCube loader: 4.6.1
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Also please add the following lines in your .htaccess of your domain which need to be loaded with CLI/mod_php

[root@tig01 custombuild]#vi /home/username/public_html/.htaccess
===================
<FilesMatch “.php$”>
AddHandler application/x-httpd-php .php
</FilesMatch>
===================

Thats all……….:)
Please let us know if you have any query about this, we are glad to assist you further.

3 thoughts on “Installing Multiple Version of PHP in Directadmin

  1. Someone essentially help to make significantly articles I would state. That is the first time I frequented your website page and thus far? I surprised with the research you made to create this actual submit amazing. Fantastic task!

  2. Hi, I do believe this is a great website. I stumbledupon it ๐Ÿ˜‰ I may revisit yet again since I bookmarked
    it. Money and freedom is the best way to change, may you be rich and
    continue to help others.

Leave a Reply

Your email address will not be published. Required fields are marked *