DirectAdmin allows the use of multiple PHP versions on the same server, supporting website software with different PHP requirements. This tutorial will guide you through setting up multiple PHP versions using CustomBuild 2.0, which supports PHP 5.3 and higher.
Preliminary Requirements
- DirectAdmin on CentOS 6 or CentOS 7
Steps to Set Up Multiple PHP Versions
Connect to Your Server via SSH
Install Required Services
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
- Update CustomBuild Version
- Navigate to the DirectAdmin folder:
cd /usr/local/directadmin
- Move the existing CustomBuild file:
mv custombuild custombuild_1.x
- Download and install CustomBuild 2.0:
wget -O custombuild.tar.gz http://files.directadmin.com/services/custombuild/2.0/custombuild.tar.gz
tar xvzf custombuild.tar.gz
- Configure CustomBuild for Multiple PHP Versions
- While in the CustomBuild folder, set 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
If using Nginx and Apache as a reverse proxy, php-fpm
mode is necessary.
Verify the Configuration
Open and edit the options.conf
file:
- Ensure the following lines are present:
php1_release=7.0
php1_mode=php-fpm
php2_release=5.6
php2_mode=php-fpm
- Recompile PHP
- This process may take some time:
- Update the Configuration
- Change PHP Versions for Domains
- By default, all websites will use the
php1_release
version. To change the PHP version for a specific domain:
- Log in to your DirectAdmin control panel.
- Navigate to "User Level".
- Select the domain.
- Click on "Domain Setup".
- At the bottom, select the desired PHP version.
This guide ensures that you can run different PHP versions on your DirectAdmin server, providing flexibility for various website requirements.