Nội dung
In this tutorial, AZDIGI will guide you to install PHP 7.4 into CentOS 6 on DirectAdmin and can be applied to PHP 8.0.
I. Introduction
Why did I previously write a tutorial on installing multiple versions of PHP on DirectAdmin and an article on installing PHP 8.0 on DirectAdmin, but now I have this article? Then I would like to explain more that these tutorials are all installed on CentOS 7, so installing new PHP versions like 7.4 or 8.0 is completely simple, but with CentOS 6 isn’t that simple.
And certainly, if you follow those instructions on CentOS 6, you will encounter many errors. In this article, I will help you debug each error and be able to install PHP 7.4 into CentOS 6 in DirectAdmin.
II. Install PHP 7.4 into CentOS 6 on DirectAdmin
To install PHP 7.4 into CentOS 6 on DirectAdmin, we need to perform the following steps.
Step 1: SSH into your server
To install PHP 7.4 into CentOS 6 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 check the version of CustomBuild in use.
Step 2: Check the Custombuild version
First, check if your VPS/Server is using 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 go to step 3 to execute the command to change the current PHP version to version 7.4.
Step 3: Change the current PHP version to PHP 7.4
My VPS only uses 1 version of PHP 7.3, so I will use the following command to upgrade.
cd /usr/local/directadmin/custombuild ./build set_fastest ./build update ./build set php1_release 7.4
In case you want to use multiple versions of PHP like 5.6 and 7.4, in which version 7.4 is the default version, you use the command below (because many old source codes can only run with PHP 5.6)
cd /usr/local/directadmin/custombuild ./build set_fastest ./build update ./build set php1_release 7.4 ./build set php1_release 5.6
If you want to use 3 or 4 PHP versions, then do the same and only DirectAdmin version 1.50.1 and above supports 4 PHP versions only.
After the configuration is complete, we execute the following command to start the process of installing PHP 7.4 into CentOS 6 on DirectAdmin with the following command:
./build php n
Sure, you will encounter errors during this installation, but don’t worry. We continue to see the article to know what these errors are and how to fix them.
III. Common errors when installing PHP 7.4 into CentOS 6 on DirectAdmin
Usually, when installing PHP 7.4 into CentOS 6 on DirectAdmin, we encounter 1 of the following 3 errors or sometimes all 3.
Error 1: cmake3: command not found
The error will have the following content:
Cannot find cmake, installing it... Loaded plugins: fastestmirror Setting up Install Process Loading mirror speeds from cached hostfile * base: *** * extras: *** * updates: *** No package cmake3 available. Error: Nothing to do Found /usr/local/directadmin/custombuild/libzip-1.5.2.tar.gz Extracting ... Done. Configuring libzip-1.5.2... ./custombuild/build: line 14579: cmake3: command not found Done. Making libzip-1.5.2... Trying to make libzip... make: *** No targets specified and no makefile found. Stop.
When you get this error, you just need to install cmake and everything is solved. To install cmake, you execute the following command:
yum -y install cmake
You can then try to reinstall PHP 7.4 with the following command:
./build php n
Error 2: configure: error: Problem with libjpeg.(a|so). Please check config.log for more information
With this error, you just need to reinstall the libjpeg
library with the command:
cd /usr/local/directadmin/custombuild ./build libjpeg
You can then try to reinstall PHP 7.4 with the following command:
./build php n
Error 3: Requested icu-uc 50.1 but version of icu-uc is X.X
With this error, AZDIGI has written a very detailed tutorial, you can refer to the link below:
When you encounter this error, you just need to update the ICU to the latest version with the following commands:
cd /usr/local/directadmin/custombuild ./build update ./build icu
You can then try to reinstall PHP 7.4 with the following command:
./build php n
At this point, you can install PHP 7.4 into CentOS 6 on DirectAdmin successfully. And after you have finished building the PHP versions, don’t forget to restore the configuration to default with the following command:
./build rewrite_confs
IV. Summary
Hopefully, through this article, you have learned how to install PHP 7.4 into CentOS 6 on DirectAdmin successfully by handling the necessary conditions on VPS using CentOS 6. However, because CentOS 6’s support life cycle has ended, you should not continue to use CentOS 6 anymore but upgrade to the latest CentOS 7 or CentOS 8 for longer-term support.
Hope this article will be of help to you. Wishing you success!
See more useful articles about DirectAdmin at the following link:
If you need assistance, you can contact support in the ways below:
- Hotline 247: 028 888 24768 (Ext 0)
- Ticket/Email: You use the email to register for the service and send it directly to: support@azdigi.com .