How to Install PHP 8.X on Debian 10 Linux

How to Install PHP 8.X on Debian10?

Here are the 4 simple steps to install latest php 8.X version on debian& Ubuntu flavored Linux servers.

Step 1 – Setup Apt Repository

$ sudo apt update

$ sudo apt install -y gnupg2 ca-certificates apt-transport-https software-properties-common

$ sudowget -qO – | sudo apt-key add –

$ sudo echo “deb buster main” | sudo tee /etc/apt/sources.list.d/php.list

Step 2 – Installing PHP 8 on Debian

$ sudo apt update 

$ sudo apt install php8.0

$ php -v

PHP 8.0.2 (cli) (built: Feb 12 2021 14:51:01) ( 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

Step 3 – Installing PHP Extensions

$ sudo apt search php8.0-*

$ sudo apt install php8.0-{mysql,imap,ldap,xml,curl,mbstring,zip}

$ php –m

Step 4 – Setup Apache with PHP 8

Below command to install Apache with PHP 8 module

$ sudo apt install apache2 libapache2-mod-php8.0

After successful installation, restart Apache service

$ sudo systemctl restart apache2

Verify that PHP modules is loaded with Apache. Create a php script with phpinfo() function under the default document root.

$ echo “<?php phpinfo(); ?>” > /var/www/html/info.php

Access this file in browser using server ip address. For example: http://server-ip/info.php

At Velan, our server support engineers can help you with install php versions on your server. We are installing like these for our clients every day. If you are interested in our service, please fill the Quick connect form to get in touch with us.


Quick Connect With Us