Follow Us:
Linux /

How to update php7.2 to php7.4

Created Date: 12th February, 2023
Updated Date: 12th February, 2023

In this post, we will be discussing the steps to upgrade your PHP version from 7.2 to 7.4.This post will provide you with the steps required to smoothly upgrade your PHP installation to version 7.4.

First thing let us check the current php version through the below command :

php -v

and the below message will appear:

PHP 7.2.34

We will add the following commands:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php7.4

Then we will start installing the following pacakages:

sudo apt install php7.4-common
sudo apt install php7.4-cli
sudo apt install php7.4-bz2
sudo apt install php7.4-curl
sudo apt install php7.4-gd
sudo apt install php7.4-intl
sudo apt install php7.4-json
sudo apt install php7.4-mbstring
sudo apt install php7.4-readline
sudo apt install php7.4-xml
sudo apt install php7.4-zip
sudo apt install php7.4-fpm
sudo apt install php7.4-cgi
sudo apt install php7.4-imap
sudo apt install php7.4-ldap
sudo apt install php7.4-mysql
sudo apt install php7.4-opcache
sudo apt install php7.4-pspell
sudo apt install php7.4-soap
sudo apt install php7.4-tidy
sudo apt install php7.4-xmlrpc

After installing all the above packages, let us disable the old version and enable the updating version of php using the below commands:

sudo a2dismod php7.2
sudo a2enmod php7.4
sudo service apache2 restart

Congratulations, now you have php7.4 , you can check the php version through this command:

php -v

Share the post:

Tags:
os
php
linux