How to install PHP 8 on Ubuntu 18.04/20.04 LTS Linux
Hi Friends, in this post we will learn how to install PHP 8 on Ubuntu Linux. we are going to install php8 on ubuntu 18.04/20.04 LTS Linux.
In this post also we will see how we can install some important PHP modules like
Let’s start the installation
Update the repository index and update the package
sudo apt update sudo apt upgrade
Install required package
sudo apt install software-properties-common
Add PPA Repository for PHP8
sudo add-apt-repository ppa:ondrej/php
Once, you have added the repository you need to perform the below command.
sudo apt update
sudo apt install php8.0
root@Linuxfork:~# php -v PHP 8.0.2 (cli) (built: Feb 23 2021 15:13:39) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.2, Copyright (c) Zend Technologies with Zend OPcache v8.0.2, Copyright (c), by Zend Technologies root@Linuxfork:~#
Install some required module for PHP
Before, installing any module of PHP search in the system is that module available or not using the below command.
root@Linuxfork:~# apt-cache search php8 | grep mbstring php8.0-mbstring - MBSTRING module for PHP root@Linuxfork:~#
Here, we can see the mbstring module is available in the library or repository so we can install it easily using the below command.
root@Linuxfork:~# apt install php8.0-mbstring
Verify the PHP module
root@Linuxfork:~# php -m | grep mbstring mbstring root@Linuxfork:~#
Note:- After installation if the PHP module is not reflecting then you need to restart the service of the web server(apache2).
I am a professional Cloud Engineer and founder of LinuxFork. I am working on Infrastructure Deployment and focusing on the integration of open source technologies with the Cloud. I am an avid Linux lover and open source enthusiast. mostly, I am working with Redhat and Ubuntu Linux in the production environment. apart from this I always believe in knowledge sharing.