Home Linux ServerWeb Server How to downgrade PHP-FPM (Downgrade php-fpm)

How to downgrade PHP-FPM (Downgrade php-fpm)

by Thạch Phạm
Published: Last Updated on
A+A-
Reset

How to downgrade PHP-FPM on the CentOS server

I. Overview

During the installation and use process, you installed the PHP-FPM version too high, which is unsuitable for the services and applications on the server for some reasons such as services, applications just running In low PHP, service applications not being updated to be compatible with the new PHP. So when you encounter this situation and you are forced to downgrade the PHP version for compatibility.

Back to the article, I just installed PHP 8.0.1, this is the latest PHP version that was just released on 11/26/2020 and you can see the changes of PHP at this link. Because the PHP version is too high, the Themes and Plugins on my WordPress website cannot work and cause errors. Therefore, I have to downgrade PHP-FPM. And on how to downgrade, please follow along.

II. Implementation Guide

To downgrade PHP-FPM, you follow 4 these steps.

Step 1: Check the current PHP version

To check the current PHP-FPM version, use the php-fpm -v command:

AZDIGI Tutorial
php-fpm -v
    

And my version is PHP 8.0.1, I will downgrade it to PHP 7.3

downgrade PHP-FPM

Step 2: Backup the configuration file

Because when you downgrade, the system will rewrite the configuration file to the original default. Therefore, you need to back up the old configuration file to restore it when the downgrade is complete.

I will clone into a new copy with the accompanying name .bak as follows: I will backup the configuration file php.ini and www.conf

AZDIGI Tutorial
cp /etc/php.ini /etc/php.ini.bak
cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.conf.bak
    

Step 3: Uninstall the PHP package

Next, you need to remove the PHP packages that appear to install on the new PHP package. And to check php packages, you can use the rpm -qa command:

  • See also: Instructions for using RPM on Linux
AZDIGI Tutorial
rpm -qa | grep php
    
downgrade PHP-FPM

And then remove all installed PHP 8.0 packages and dependencies with the following command with the yum remove command.

AZDIGI Tutorial
yum remove php-*
    
downgrade PHP-FPM

Step 4: Install the new PHP package

Now perform the PHP-FPM downgrade with the following command: Disable the old repo and enable the new repo. Since I need to downgrade PHP8 to PHP73, I will do disablerepo=remi-php80 and enablerepo=remi-php73

Note: Please change the current PHP version and the version you need to downgrade for the system to work correctly.

AZDIGI Tutorial
yum --disablerepo=remi-php80 --enablerepo=remi-php73 install php php-common php-gd php-xml php-fpm php-mysqlnd php-json php-mbstring php-xmlrpc php-opcache php-mysql
    

Downgrading time is quite fast. It only takes a few minutes to complete and after the downgrade is successful, you can restore the previously backed-up configuration files.

AZDIGI Tutorial
rm -rf /etc/php.ini
mv /etc/php.ini.bak /etc/php.ini

rm -rf /etc/php-fpm.d/www.conf
mv /etc/php-fpm.d/www.conf.bak /etc/php-fpm.d/www.conf
    

Start and check the PHP-FPM status

AZDIGI Tutorial
systemctl start php-fpm
systemctl enable php-fpm
systemctl restart php-fpm
systemctl status php-fpm
    

And now use the php -v command again to check the PHP version. As shown below, I have done the complete downgrade.

Screenshot 2021 01 23 at 18.42.24@2x

See more:

III. Summary

So with the above steps, you have downgraded PHP-FPM completely and effectively. Wishing you success! See more useful articles about Linux VPS at the following link:

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