How to upgrade to PHP 8 on CentOS 7

In this tutorial I will show you how to upgrade to PHP version 8 on CentOS 7. Having the latest stable PHP 8 will fix many older vulnerabilities. Lets follow these quick steps below to upgrade your PHP version.

Before moving forward make sure to have a backup image of your server.

  1. Open your console windows and connect to your server.
  2. Lets start by disabling all the old PHP versions.
yum-config-manager --disable remi-php56
yum-config-manager --disable remi-php70
yum-config-manager --disable remi-php71
yum-config-manager --disable remi-php72
yum-config-manager --disable remi-php73
yum-config-manager --disable remi-php74

3. Lets run the following commands individually to download the PHP 8 packages we need.

rpm -Uvh remi-release-8.rpm epel-release-latest-8.noarch.rpm

4. We will now run the commands to install the latest PHP version 8 software.

yum install yum-utils
yum-config-manager --enable remi-php80
yum update -y

5. You should now be on the latest version of PHP 8. You can check your version by typing in php -v in the console window.

6. Update all your websites and or applications to use the latest PHP build you installed.

I hope this article was helpful, if you have any questions, please feel free to contact me. If you would like to be notified of when I create a new post, you can subscribe to my blog alert.


  1. thanks for the post. the update was successful, but php codes appear on my page, they are not interpreted, what can I do?

    1. Hello, thank you for stopping by. What do you mean PHP code appear on your page? When you load the website you see a string of PHP loading with the content? Can you provide the full string that it is showing?

Leave a Comment