Jump to content

How to set up multiple PHP versions in DirectAdmin


Recommended Posts

DirectAdmin is one of the several control panels that allow using multiple PHP versions. In that way, you can support website software on the same server that requires different PHP versions.  

In order to use DirectAdmin multi PHP function, you need to have a CustomBuild and in this tutorial, CustomBuild 2.0 version will be installed. CustomBuild 2.0 only supports php 5.3 and higher.

0. Preliminary requirements
 

DirectAdmin using CentOS 6 or CentOS 7
 
1. Connect to your server via SSH.
 

2. Install the required services using the command bellow:

yum install wget gcc gcc-c++ flex bison make bind bind-libs bind-utils openssl openssl-devel perl quota libaio \
libcom_err-devel libcurl-devel gd zlib-devel zip unzip libcap-devel cronie bzip2 cyrus-sasl-devel perl-ExtUtils-Embed \
autoconf automake libtool which patch mailx bzip2-devel lsof db4-devel psmisc net-tools systemd-devel libdb-devel perl-DBI xfsprogs rsyslog logrotate crontabs


3. Update the CustomBuild version:

* Go to DirectAdmin folder:

cd /usr/local/directadmin

* Move the file here:

mv custombuild custombuild_1.x

* Install the file:

wget -O custombuild.tar.gz http://files.directadmin.com/services/custombuild/2.0/custombuild.tar.gz

* Extract the file:

tar xvzf custombuild.tar.gz

* Go to CustomBuild folder:

cd custombuild

* Run CustomBuild:

./build

4. Change the CustomBuild configuration for it to allow several PHP versions. It can be done by changing the "options.conf" file or using SSH and command line. While you still are in the CustomBuild folder, change the required options:

./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set php1_release 7.0
./build set php2_release 5.6

The php-fpm mode change is required if you are using Nginx and Apache as a reverse proxy.

5. Open the "options.conf" file:

vi options.conf

Check if the lines are as seen bellow:

php1_release=7.0
php1_mode=php-fpm
php2_release=5.6
php2_mode=php-fpm

6. Recompile PHP (it will take a while):

./build php n

7. Update the configuration:

./build rewrite_confs
8. Now you will be able to change the PHP versions for each domain inside the DirectAdmin control panel. By default, all the websites on your control panel will be using the "php1_release" set PHP version. If you want to change the PHP version for the specific website, login into your DirectAdmin control panel, press on the "User Level" and select the domain. Then click on "Domain Setup" and on the bottom, you will see a possibility to select the wanted PHP version.
 
b4936c6ea9c2bfc45a138108dbff26fa.png
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...