Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»General Articles»How To Install PHP 8 on Debian 10

    How To Install PHP 8 on Debian 10

    RahulBy RahulFebruary 17, 20213 Mins Read

    PHP is a scripting language, and a powerful tool for developing dynamic and interactive Web pages. It was originally created in 1994 by Danish-Canadian programmer Rasmus Lerdorf. According to W3Techs’ data, PHP is used by 78.9% websites running in public network. So almost 8 out of every 10 websites on the Internet are using PHP in some way.

    PHP 8.0 is the latest available version for the web development. It is the most advanced and secure version released by the PHP Team.

    This tutorial will help you to install PHP 8.0 on Debain 10 Buster Linux system.

    Step 1 – Setup Apt Repository

    Ondrej Sury is maintaining the PPA that contains the latest PHP packages for the Debian systems.

    1. Let’s start with the installation of some required packages on your system. Open a terminal and execute following commands:
      sudo apt update 
      sudo apt install -y gnupg2 ca-certificates apt-transport-https software-properties-common 
      
    2. Next, add the GPG key to your system to verify the packages before installation.
      wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add - 
      
    3. Create a PPA file to your system with php repository on your buster Linux system.
      echo "deb https://packages.sury.org/php/ buster main" | sudo tee /etc/apt/sources.list.d/php.list 
      

    Step 2 – Installing PHP 8 on Debian

    Your system is ready for the PHP installation. Use following commands to install PHP 8 on Debian system.

    sudo apt update  
    sudo apt install php8.0 
    

    Fist command will update the apt cache on your system and second command will install PHP packages.

    Once the installation finished, verify the PHP version on terminal.

    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

    PHP comes with multiple extensions (also known as modules) to preform specific tasks. You can install these extensions on your system as per your requirements.

    First, search for available modules in repository:

    sudo apt search php8.0-* 
    

    Then install required php modules on your system. The following command will install some frequently used PHP modules on your system.

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

    You can check for currently installed and active PHP modules on your system by running following command.

    php -m 
    

    You can visit another article about enable or disable PHP modules on a Debian system systems.

    Step 4 – Setup Apache with PHP 8

    Generally the above commands also install Apache PHP extension on your system. But incase not installed, execute below command to install Apache with PHP 8 module.

    sudo apt install apache2 libapache2-mod-php8.0 
    

    After successful installation, restart Apache service to reload newly installed modules.

    sudo systemctl restart apache2 
    

    Next, verify thta 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

    Install PHP 8 on Debian 10

    You will see the detailed PHP information on the web page.

    Conclusion

    This tutorial helped you to install PHP 8.0 on Debian 10 system.

    Debian 10 PHP PHP 8
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Search in Vim / Vi
    Next Article How to Install IntelliJ IDEA on Ubuntu 20.04

    Related Posts

    How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04

    Updated:May 9, 20223 Mins Read

    How to Find Django Install Location in Linux

    Updated:April 27, 20221 Min Read

    (Resolved) – ReactJS 404 Error on Page Reload

    2 Mins Read

    How To Install LAMP Stack on Ubuntu 22.04 LTS

    Updated:April 20, 20225 Mins Read

    Adding a New SSH Key in GitHub

    Updated:April 1, 20223 Mins Read

    13 Best Linux Terminal Emulators and Bash Editors

    8 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Enable / disable Firewall in Windows
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.