<\/span><\/h2>\r\n\r\n\r\n\r\nFirst, log in to your Ubuntu 20.04 server via SSH as the root user:<\/p>\r\n\r\n\r\n\r\n
ssh root@IP_Address -p Port_number<\/pre>\r\n\r\n\r\n\r\nYou will need to replace \u2018IP_Address\u2018 and \u2018Port_number\u2018 with your server\u2019s respective IP address and SSH port number. Additionally, replace \u2018root\u2019 with the username of the admin account if necessary.<\/p>\r\n\r\n\r\n\r\n
Before starting, you have to make sure that all Ubuntu OS packages installed on the server are up to date. You can do this by running the following commands:<\/p>\r\n\r\n\r\n\r\n
apt-get update -y\r\napt-get upgrade -y<\/pre>\r\n\r\n\r\n\r\n<\/span>3. Add PHP Repository<\/span><\/h2>\r\n\r\n\r\n\r\nBy default, the PHP 8.0 is not included in the Ubuntu 20.04 default repository. So you will need to add the ondrej\/php PPA repository to your system.<\/p>\r\n\r\n\r\n\r\n
First, install the required dependencies using the following command:<\/p>\r\n\r\n\r\n\r\n
apt-get install software-properties-common -y<\/pre>\r\n\r\n\r\n\r\nNext, add the ondrej\/php PPA repository with the following command:<\/p>\r\n\r\n\r\n\r\n
add-apt-repository ppa:ondrej\/php<\/pre>\r\n\r\n\r\n\r\nOnce the repository is added, you can update it with the following command:<\/p>\r\n\r\n\r\n\r\n
apt-get update -y<\/pre>\r\n\r\n\r\n\r\n <\/figure>\r\n\r\n\r\n\r\n<\/span>4. Install PHP 8.0 with Apache<\/span><\/h2>\r\n\r\n\r\n\r\nYou can install the Apache web server with PHP 8.0 by running the following command:<\/p>\r\n\r\n\r\n\r\n
apt-get install apache2 php8.0 libapache2-mod-php8.0 -y<\/pre>\r\n\r\n\r\n\r\nOnce the installation is completed, restart the Apache service to load the PHP.<\/p>\r\n\r\n\r\n\r\n
systemctl restart apache2<\/pre>\r\n\r\n\r\n\r\nYou can also install the most commonly used PHP extensions using the following command:<\/p>\r\n\r\n\r\n\r\n
apt-get install php8.0-common php8.0-mysql php8.0-xml 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 -y<\/pre>\r\n\r\n\r\n\r\n