Home WebServer PanelDirectAdmin How to install multiple versions of PHP DirectAdmin

How to install multiple versions of PHP DirectAdmin

by Thạch Phạm
Published: Last Updated on
A+A-
Reset

I. Overview

Installing multiple versions of PHP DirectAdmin will be very useful if your DirectAdmin VPS/server runs many different websites. But many websites are not compatible with the new PHP version, or many websites can only run PHP 7.0 or higher but not with PHP 5.6.

In this article, AZDIGI will guide you to install multiple versions of PHP DirectAdmin as quickly and easily as possible.

Below is a table comparing the speed of PHP versions with the WordPress source code.

install multiple versions of PHP DirectAdmin

As you can see, with a higher PHP version, we will get a much higher processing speed than the old version. It can be up to 3 times if comparing PHP 7.4 and PHP 5.6. Corresponding to that, if processing the same task, the CPU usage of PHP 7.4 is also three times lower than that of PHP 5.6. Therefore, if possible, you should prioritize using PHP 7.

II. Conditions required before installing multiple versions of PHP DirectAdmin

To install multiple versions of PHP DirectAdmin, we need to satisfy 2 conditions. But you need to SSH into your VPS or Server first.

If you don’t know how to SSH into your VPS/Server, you can refer to the following tutorial:

After you have SSH, you continue to check the conditions below.

Condition 1: DirectAdmin version must be equal to or greater than 1.50.1

To check the DirectAdmin version in use, we use the following command:

AZDIGI Tutorial
/usr/local/directadmin/directadmin v
    

Below is the result on my VPS:

Screen Shot 2020 07 18 at 12.47.37 AM

The version of DirectAdmin I am using is 1.61.3, so the first condition is satisfied. If your version is older, then you need to upgrade DirectAdmin by these instructions:

Condition 2: Requires Custombuild 2.0 and above version

To check the version of Custombuild in use, use the command:

AZDIGI Tutorial
cd /usr/local/directadmin/custombuild
./build version
    

Below is the result on my VPS:

Screen Shot 2020 07 18 at 12.57.13 AM

My Custombuild version is 2.0, so condition #2 is satisfied. If your version is older, you need to upgrade Custombuild according to the following instructions:

After satisfying the above two conditions, we will install multiple versions of PHP DirectAdmin.

III. Enable running multiple PHP DirectAdmin versions

To install multiple versions of PHP DirectAdmin, follow these 2 steps:

Step 1: Configure the PHP versions you want to use

I will let the system run parallel to 4 versions of PHP 7.4, PHP 7.3, PHP 7.2 and PHP 5.6. And PHP 7.4 is the system’s default PHP version.

AZDIGI Tutorial
cd /usr/local/directadmin/custombuild
./build update
./build set php1_release 7.4
./build set php2_release 7.3
./build set php3_release 7.2
./build set php4_release 5.6
    

Note: If you are using CentOS 6, you should stop at PHP 7.3. But if you still want to install PHP 7.4 on CentOS 6, follow the instructions below:

Below is the screen displayed on my VPS after running the above commands:

Screen Shot 2020 07 18 at 1.11.43 AM

Because before my VPS only ran 2 versions of PHP, 5.6 and 7.4, so in the picture above, you will see two options from no to 7.2 and 5.6. Currently, DirectAdmin only supports up to 4 PHP versions.

Step 2: Recompile all PHP versions

To recompile all PHP versions, we use the following commands:

AZDIGI Tutorial
cd /usr/local/directadmin/custombuild
./build php n
./build rewrite_confs
    

Note: This process can take quite a bit of your time. The long or short time will depend on the CPU performance of your VPS/Server.

Below is a picture of the completed installation on my VPS:

Screen Shot 2020 07 18 at 1.37.33 AM

Depending on your settings, the final image may look slightly different.

IV. Change the PHP version on the DirectAdmin interface

You can now change the PHP version of websites in the DirectAdmin interface at the User Level.

To change the PHP version, you need to access the Domain setup feature as shown below:

Screen Shot 2020 07 18 at 1.41.20 AM

Continue to select the domain where you want to change the PHP version and select PHP Version Selector, you will see the PHP versions installed in the above steps.

Screen Shot 2020 07 18 at 1.42.13 AM

After changing the PHP version, wait for 1 to 2 minutes for DirectAdmin to update your website.

V. Summary

So you know how to install multiple versions of PHP DirectAdmin. Wishing you success!

If you need assistance, you can contact support in the ways below:

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign