Nội dung
When you install CyberPanel, by default, CyberPanel developers will install their default PHP version on the operating system which is PHP 7.1 version. Many users may confuse this PHP version with a custom PHP version to run the website, but the two versions are completely different.
To customize the PHP version for websites, you can refer to the instructions below (currently, CyberPanel has customized PHP up to version 7.4)
So how to change the default PHP version of CyberPanel, then in this article AZDIGI will guide you on how to change this default PHP version, you can see the steps below.
Implementation guide
Step 1: Check the current default PHP version of the VPS
To check the default version, you need to SSH into the VPS as root, if you don’t know how to SSH into the VPS, you can refer to the article below:
After SSH into the VPS, you can check the PHP version of the currently running VPS by using the command:
php -v
As shown above, currently this VPS is using PHP version 7.1.
Step 2: Determine of location the PHP file
To determine the path of this PHP file, use the command:
which php
So the path containing the PHP file is located at /usr/bin/php
Step 3: Change the PHP version
In this step, copy the lsphp version to replace /usr/bin/php
(the system’s default PHP version) with the following command:
cp /usr/local/lsws/lsphp74/bin/lsphp /usr/bin/php
(74 is the new PHP version I want to upgrade, if you want to change 7.2 or 7.3 please replace it with 72 and 73).
When running the command, the system will ask if you want to overwrite the current PHP version, press Y to agree.
So the upgrade process is complete. To check if the version you just changed has been successful, run the php -v command again to see the PHP version after the upgrade.
The PHP version has been changed completely from 7.1 to 7.4.
Summary
Thus, AZDIGI has completed the steps to change the default PHP version of Cyber Panel in a simple way with only one command line. This PHP change will be suitable in cases where you need to install some extensions and scripts on VPS and requires a separate PHP version to work. Hope the article is helpful to you. Wishing you success!
Reference articles:
Wishing you success!
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