How To Install PHP 8 on Debian 11

PHP is a popular server-side scripting language. This guide explains how to install PHP 8 on Debian 11.

Install PHP 8 on Debian 11

To install PHP 8 on Debian, you must set up the deb.sury.org repository.

  1. Add the repository key.

    $ wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
    
  2. Add the repository.

    $ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
    
  3. Update the package index.

    $ sudo apt update
    
  4. Install PHP 8.0 from the deb.sury.org repository.

    $ sudo apt install php8.0
    
  5. Verify the PHP 8 installation.

    $ php -v
    

Extensions

PHP extensions add new functionality to PHP.

  • To check the list of installed extensions:

    $ php -m
    
  • To find available extensions, see the extension list.

  • Use apt to install extensions:

    $ sudo apt install php8.0-{extension name}
    

    For example, to install the MySQL extension:

    $ sudo apt install -y php8.0-mysql
    

 

  • Install PHP 8, Debian 11
  • 28 Users Found This Useful
Was this answer helpful?

Related Articles

How to Set Up a Mac for Your Kids

Providing children with access to a computer and the internet is increasingly important, but so...

How to Get Help With a Command from the Linux Terminal

Whether you’re an inexperienced terminal user or a grizzled veteran, you won’t always know the...

How to change the ssh port on Linux

To Change the SSH Port for Linux Server Connect to your server via SSH Switch to the root...

How To Install screenFetch in Linux

If you've browsed Linux groups on social media, you've probably seen a lot of screenshots that...

Static IP vs. Dynamic IP Address

A static IP address is one that remains fixed and never changes. The PC always sees the same...

Powered by WHMCompleteSolution