❤️ AZDIGI has officially updated to a new blog system. However, some posts may have incorrect or mismatched images. Please click the Report article button at the bottom of the post so AZDIGI can update as quickly as possible. Thank you!

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:

AZDIGI Tutorial
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:

AZDIGI Tutorial
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:

AZDIGI Tutorial
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:

Share:
This article has been reviewed by AZDIGI Team

About the author

Thạch Phạm

Thạch Phạm

Đồng sáng lập và Giám đốc điều hành của AZDIGI. Có hơn 15 năm kinh nghiệm trong phổ biến kiến thức liên quan đến WordPress tại thachpham.com, phát triển website và phát triển hệ thống.

10+ years serving 80,000+ customers

Start your web project with AZDIGI