How to upgrade PHP 7.4 on ubuntu using terminal ?

Upgrade latest version of PHP in your ubuntu 18.04. Using terminal we can upgrade this. Below is the step to guide you how to upgrade PHP version.

To upgrade we need to add ondrej/php which has PHP 7.4 package and other required PHP extensions.

sudo apt install software-properties-common

sudo add-apt-repository ppa:ondrej/php

After that update with :

sudo apt update

Once we add ppa in your system you can install new PHP with this command :

sudo apt install php7.4

Install some most commonly use php extension for you newly installed php.

sudo apt install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl -y

After successfully installation you can check your PHP version with :

php -v

Now restart your apache server to effective your changes :

sudo service apache2 restart

Enjoy your new php. Thanks

Dynamic Add Section
Dynamic Add Section