Upgrade PHP version to PHP 8.0 on Ubuntu

Upgrade PHP version to PHP 8.0 on Ubuntu

To avail new features and security improvements on your website, you need to upgrade your PHP version. If you are running Ubuntu OS on any cloud server like AWS, Azure, GCP, etc. to run your website, then follow the steps for upgrading any php version to PHP 8.0.

Here are the very simple steps that you can follow to upgrade the PHP version to PHP 8.0.

First, you need to login using SSH through putty or terminal.

After logging in, follow these steps.

1. Add PPA for PHP 8.0

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

2. Install PHP 8

sudo apt install php8.0

3. 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

4. Enable PHP 8

sudo a2dismod php7.4
sudo a2enmod php8.0

sudo service apache2 restart

Now to check php version. Use Following Command.

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.

× Chat with me