---
title: 'Upgrading and downgrading PHP on CentOS 7 | Zomro'
description: 'This article will allow you to update the php version and downgrade it if the site does not accept the version already installed on the server.'
image: 'https://dx86q6oq7ry0e.cloudfront.net/uploads/blog/seo%40server-panel.net/2023/12/05/commands_lamXHen_q50.jpg'
---

![opened image]()

  * [Zomro](https://zomro.com/)
  * [FAQ](https://zomro.com/blog/faq/)
  * Upgrading and downgrading PHP on CentOS 7 



# Upgrading and downgrading PHP on CentOS 7

30-11-2023

This article will guide you through updating and downgrading the PHP version, especially when your website requires a different PHP version than the one installed on the server. For example, if your CMS WordPress needs PHP 7.3, but the server has PHP 5.6.

## 

## **Updating php version**

## 

  
Preparation: First, install the repositories needed to install PHP. Use the following commands:
    
    
    yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
    yum install yum-utils

![Upgrading and downgrading PHP on CentOS 7 - 1](https://dx86q6oq7ry0e.cloudfront.net/uploads/blog/seo%40server-panel.net/2023/12/05/commands_lamXHen_q50.jpg)

We've set up the base for managing PHP versions. Currently, PHP 5.6 is installed. In this article, we'll update it to 7.4 and then downgrade it back to 5.6.

![Upgrading and downgrading PHP on CentOS 7 - 2](https://dx86q6oq7ry0e.cloudfront.net/uploads/blog/seo%40server-panel.net/2023/12/05/56_rlMO3or_q50.jpg)

Warning: Upgrading PHP may affect the functionality of PHPMyAdmin and other applications tied to a specific PHP version.

  
Update: To update PHP, activate the repository with the new PHP version:
    
    
    yum-config-manager --enable remi-php74

  
Replace '74' with your desired PHP version. Then, run the update command:
    
    
    yum update

Confirm the installation of PHP 7.4 packages. Check the PHP version with:
    
    
    php -v

You should see the updated version.

## **Downgrading php version**

## 

Downgrade: To downgrade, install the PHP repositories and yum-utils (commands in the Preparation section).

First, find out which modules are installed on the current PHP version:
    
    
    php -m

![Upgrading and downgrading PHP on CentOS 7 - 3](https://dx86q6oq7ry0e.cloudfront.net/uploads/blog/seo%40server-panel.net/2023/12/05/php-m_7hVzJar_q50.jpg)  
Copy the list of modules; you'll need it when installing the new PHP version.

  
Remove the old PHP version and its modules:
    
    
    yum remove php php-*

  
Disable the repository for the current PHP version and enable the one you need (e.g., PHP 5.6):
    
    
    yum-config-manager --disable remi-php74 --enable remi-php56

  
Install PHP and modules for the desired version:
    
    
    
    yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo

Check installed modules:
    
    
    php -m

Compare with the modules from the old version. If any are missing, install them with:
    
    
    yum install php-module_name php-module_name php-module_name

You've successfully downgraded PHP on CentOS 7.

We also suggest you other useful articles:

  * [Install ffmpeg-php on Centos 7 and Ubuntu 20](https://zomro.com/blog/faq/345-install-ffmpeg-php-on-centos-7-and-ubuntu-20)
  * [How to install FileGator on Centos Nginx-PHP-FPM](https://zomro.com/blog/faq/381-how-to-install-filegator-on-centos-nginx-php-fpm-zomro)
  * [Updating/Downgrading PHP Versions on Ubuntu](https://zomro.com/blog/faq/436-updatingdowngrading-php-versions-on-ubuntu)



Similar articles:

[How to connect to Windows Remote Desktop using macOS](https://zomro.com/blog/faq/194-kak-podkljuchitsja-k-udalennomu-rabochemu-stolu-windows-sredstvami-macos) [Check website performance using the hosts file](https://zomro.com/blog/faq/146-proverit-rabotu-sajta-pri-pomoschi-fajla-hosts) [How to set up a Samba server on Linux and connect to it from Windows Server 2019](https://zomro.com/blog/faq/334-how-to-set-up-a-samba-server-on-linux-and-connect-to-it-from-windows-server-2019) [Adding a database to the VestaCP panel](https://zomro.com/blog/faq/387-adding-a-database-to-the-vestacp-panel) [Creating Minecraft Java Servers.](https://zomro.com/blog/faq/325-creating-minecraft-java-servers)

[ Dedicated servers from €88.80/mon ](/dedicated-servers)
