CentOS7: Update PHP version to the latest (v 7.4.6)

Why do I need to update the PHP version on my CentOS 7 server?

I set up this site quite a long time back and when I logged in to the admin panel I just noticed that still, I’m using some old version of WordPress. So I decided to update to the latest version. WordPress upgrade is seamless and within just a few clicks I was able to update to the latest version. When I’m navigated back to the dashboard I noticed an error message saying that I’m using an insecure version of PHP and warn me to update it.

I thought “Will do it later”. Then I wanted to add some plugins to enhance the site a bit. When I’m going to install some plugins I noticed that my current PHP version is not supported for that plugin and won’t allow me to install.

So I had to move my lazy ass and upgrade the PHP version to the latest. It’s quite a long time that I’m away from PHP. I even don’t know what is the latest version. I just google it and got to know that it’s PHP 7.4.6 🙂


It’s CentOS 7 server and my first step is to just upgrade the available packages. So I run

sudo yum update

Then I started updating the PHP version to the latest. Please follow the below steps if you also want to update the PHP version of your CentOS 7 server as well.


How do I update the PHP version in CentOS 7 server?

1. First turn on the EPEL repo

sudo yum -y install epel-release

2. Activate remi-php74 repository

sudo yum-config-manager --enable remi-php74

3. Update yum repository

sudo yum update

4. Install PHP 7.4

sudo yum install php

5. Verification

php --version

Now you can see, the latest PHP version is installed in your server.

Happy Coding!