Nội dung
In today’s article, AZDIGI will show you how to install PHP 8.0 on DirectAdmin. Although this is only one of the first trial versions for users, let’s just install and experience it first.
I. Overview
At the time of writing this article is the beginning of November 2020, the latest official PHP version is PHP 7.4. However, PHP 8.0 has released RC3. So you can understand the RC (Release Schedule) version is a beta version, but users can completely download it to install and use it.
Talking more about PHP 8.0, the most expected feature is the JIT (Just in Time) compiler. So what is JIT?
PHP JIT is implemented almost independently, it can be enabled/disabled at compile time of PHP code. When enabled, PHP code is stored in a cache area and will be run on request.
In short, JIT will help PHP compile faster, this is what programmers want most in any programming language.
To compare how JIT and the old compiler are different, please watch the video to execute a PHP code to create 3D images.
Regarding the main issue, please see the steps to install PHP 8.0 on DirectAdmin below.
II. How to install PHP 8.0 on DirectAdmin
To install PHP 8.0 on DirectAdmin, follow these 3 steps.
Step 1: SSH into your DirectAdmin system
To install PHP 8.0 on DirectAdmin, we first need to SSH or access your VPS/server with root privileges. If you don’t know how to SSH into your VPS/Server, you can refer to the following tutorial:
After successfully SSH, we continue with step 2 to perform the commands to install PHP 8.0 on DirectAdmin.
Step 2: Install PHP 8.0 on DirectAdmin
First, check if your VPS/Server is running CustomBuild 2.0 version. To check the version of CustomBuild you are using, please check out the following short tutorial:
In case your CustomBuild version is lower than 2.0 then you need to upgrade CustomBuild 1.x to 2.0 , you can check out the following tutorial:
After having CustomBuild 2.0, we continue to use the following commands to install PHP 8.0 on DirectAdmin:
cd /usr/local/directadmin/custombuild
./build update
cat options.conf | grep php
First, I used the above 3 commands to move to the custombuild directory, update the custombuild script and check the PHP versions.
My VPS is using only 1 version of PHP 7.3, so I will install PHP 8.0 as the second PHP. Depending on the case, you can change the following commands accordingly.
You should install PHP 8.0 in the unconfigured items; mine 2,3 and 4 are empty, so I will install 2,3,4. To avoid the case that the PHP 8.0 version is not compatible, I can adjust it back to 7.3.
We continue with the following commands:
./build set php2_release 8.0
./build set php2_mode php-fpm
./build php_expert 8.0 php-fpm
Explanation of the above commands:
- Command 1: Adjust the 2nd PHP version from empty to 8.0.
- Command 2: Adjust the 2nd PHP mode from empty to php-fpm.
- Command 3: Install/Reinstall PHP 8.0 version corresponding to PHP mode is php-fpm. This command is often used to install a PHP version to save time and the server’s CPU.
Below is an image after I have finished installing PHP 8.0 version:
So we have successfully installed PHP 8.0 on DirectAdmin. In addition, to increase the performance of all PHP versions on the server, you should enable OPCache, how to install OPCache? Please refer to the following tutorial:
From now on, you should be able to see the PHP 8.0 version option on the Domain Setup interface.
Below is an image of some basic information about PHP 8.0 when I created the info.php file.
III. Summary
So AZDIGI has completed the steps to install PHP 8.0 on DirectAdmin. Because this version of PHP will not be officially released until December 2020, the versions should only be installed and used for testing first.
Hope this article will be of help to you. Wishing you success!