Home WebServer PanelFastPanel How to change the default PHP version on FASTPANEL

How to change the default PHP version on FASTPANEL

by
Published: Last Updated on
A+A-
Reset

In the process of using FASTPANEL sometimes you will encounter some problems that aren’t on the FASTPANEL Wiki page. Among them, an inherent problem of FASTPANEL is that the default PHP version is too low, affecting the execution of PHP-related commands in an SSH environment.

And in this tutorial, AZDIGI will guide you to change the default PHP version to make it easier to use PHP commands on the SSH interface.

I. What is FASTPANEL?

FASTPANEL is an outstanding free web control panel with a lot of features such as:

  • Create a website with just a few clicks.
  • Email management.
  • Database management.
  • Manage backup/restore to the cloud.
  • Website traffic analysis.
  • Create user.
  • Two-factor authentication is supported.
  • Support SSL.
  • Support Firewall.
  • Support Cron.
  • Supports multiple PHP versions.
  • Integrated AI-BOLIT malware scanning.
  • Integrated Spam Asasin.
  • Supports command manipulation without SSH through the console.
  • And many other features…

Below is the FASTPANEL interface:

install FASTPANEL into CentOS 7

II. How to change the default PHP version on FASTPANEL

To change the default PHP version on a system using FASTPANEL, we follow these 3 steps.

Step 1: SSH into your CentOS 7 system

To change the default PHP version, first, we need to SSH or access your VPS or server as root. If you do not 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 default PHP version being configured.

Step 2: Check the PHP version being configured

To check the PHP version being configured, we use the following command:

AZDIGI Tutorial
php -v
    

Below is the result of my VPS:

image 16

As you can see, the default PHP version when using the php command on the system is5.4.16. This is an extremely low version compared to the current PHP latest version is 7.4.

When the default PHP version is so low, you will have many problems if you need to execute PHP source code that requires a higher PHP version or simply cannot use WP-CLI because WordPress requires a PHP version of at least 5.6.20 is required to run.

So how to change the default PHP version to 7.4, please follow step 3.

Step 3: Change the default PHP version to a higher PHP version

In case you have installed other PHP versions on the FASTPANEL interface and you have not installed them, please refer to the following instructions to install other versions:

After you have the desired PHP version, use the following command to view the execution paths of the PHP versions:

AZDIGI Tutorial
whereis php
    

Here is my result.

Screen Shot 2020 10 04 at 6.05.01 PM

Because I only installed 1 more PHP version, 7.4, there is only 1 path /opt/php74/bin/php, if you install many other PHP versions, you will see more results.

Next, execute the following commands to replace the default PHP version with PHP 7.4.

AZDIGI Tutorial
rm /usr/bin/php
ln -s /opt/php74/bin/php /usr/bin/php
php -v
    

Explanation of the above commands:

  • Command 1: Disable php command execution with the old PHP version. Choose y when asked.
  • Command 2: Associate the php command with the new PHP version path.
  • Command 3: Check the default PHP version just linked.

Here is a process of change my default PHP version:

change the default PHP version

The commands may be slightly different if you have different versions of PHP installed.

So we are done with the operation to change the default PHP version when using the FASTPANEL installation system.

III. Summary

Hopefully, this article will help you to change the default PHP version on VPS/Server using FASTPANEL successfully.

If you find the article useful, don’t forget to rate it 5 stars!

Wishing you success!

In addition, you can check out some other articles about FASTPANEL at the link below:

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