In this tutorial, I will show you how to install PHP 8 on your Ubuntu server.
Getting Started
Make sure your server is having the latest packages by running the command.
apt update && apt upgrade -yInstall the below packages
apt -y install lsb-release apt-transport-https ca-certificates wgetThe latest PHP packages are available in the Ondřej Surý PPA repository.
Add the repository to your system.
add-apt-repository ppa:ondrej/phpHit enter key when prompted to add the repository.
Install PHP 8
Next, update the system repositories to start using the PPA
apt install php8.0
Verify installation
php -vI have apache installed on my server, so I can verify PHP 8 installation in PHP sample file.
echo "<?php phpinfo();" > /var/www/html/info.phpNow open in browser http:/your-IP/info.php
That’s all, you have successfully installed PHP 8 on your Ubuntu server.




