Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

[DirectAdmin] Setting up multiple PHP versions in DirectAdmin

ReginaRegina Moderator
edited November 2019 in Web hosting control panels
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
* Extract the file:
tar xvzf custombuild.tar.gz
* Go to CustomBuild folder:
cd custombuild
* Run CustomBuild:
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:


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.

Sign In or Register to comment.


Learn how to install a web and database server, email, FTP client or other applications. Discover and share information on server security or optimization recommendations.
Feel free to join our constantly expanding community, participate in discussions, strengthen your knowledge on Linux and Windows server management!
© 2013 - 2024 Time4VPS. All rights reserved.

Get In Touch