How to Upgrade PHP Version from 7.4 to 8 in Ubuntu?

By Hardik Savani May 14, 2024 Category : PHP

Here, i will show you how to works update php 7.4 to 8 ubuntu. you will learn upgrade php 7.4 to 8 ubuntu. it's simple example of how to upgrade php 7.4 to 8 ubuntu. this example will help you ubuntu update php 7.4 to 8. Follow bellow tutorial step of ubuntu 20 upgrade php 7.4 to 8.

just follow bellow command to update php 7.4 to php 8 in ubuntu os.

Add PPA for PHP 8.0

sudo apt install software-properties-common

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

Install PHP 8

sudo apt install php8.0

Install PHP 8 Packages

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

PHP 8 Enable

sudo a2dismod php7.4

sudo a2enmod php8.0

sudo service apache2 restart

now you can check php version:

php -v

If it's still show old php version then you can run bellow command and choose new php version from there list. so run bellow command:

sudo update-alternatives --config php

Then it will works

i hope it can help you....

Tags :
Shares