How To Set up PHP 8.0 on Debian 11 | Holhol24

0

PHP is an open-source, general-purpose scripting language this is particularly fitted to internet building however has additionally been used as a general-purpose programming language.

Rasmus Lerdorf created it in 1994, then simply “Personal Home Page/Forms Interpreter” and got here from the merger of 2 an identical server scripting languages: – PHP/FI (Paperwork Interpreter) and – PHP/fast.

On this submit, we can see set up PHP 8 on Debian 11.

Upload PHP Repository

To put in PHP 8 on Debian, we want to arrange the SURY repository. It gives PHP 8 programs for Debian working device.

First, replace the repository cache.

sudo apt replace

Set up the under programs.

sudo apt set up -y curl wget gnupg2 ca-certificates lsb-release apt-transport-https

Import the general public the usage of the under instructions.

wget https://programs.sury.org/php/apt.gpg

sudo apt-key upload apt.gpg

Upload the SURY repository in your device.

echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /and so forth/apt/assets.listing.d/php8.listing

Replace the repository index.

sudo apt replace

Set up PHP 8

Set up PHP v8.0 with the next command.

sudo apt set up -y php8.0 php8.0-cli php8.0-common

You’ll even have a couple of PHP variations for your device. Each and every PHP model may have separate configuration information below /and so forth/php/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/{8/7}.X listing.

In case you need to put in PHP v7.4, use the next command to put in it.

sudo apt set up -y php7.4 php7.4-cli php7.4-common

Set Default PHP Model

In case your device has a couple of PHP variations, You’ll set the default PHP model with the update-alternatives command. Exchange php8.0 with the model you need to set because the default PHP model.

sudo update-alternatives --set php /usr/bin/php8.0

Test PHP Model

While you put in the PHP, test the model.

php -v

Output:

PHP 8.0.9 (cli) (constructed: Jul 30 2021 13:09:45) ( NTS )
Copyright (c) The PHP Workforce
Zend Engine v4.0.9, Copyright (c) Zend Applied sciences
with Zend OPcache v8.0.9, Copyright (c), through Zend Applied sciences

PHP Reinforce for Internet Server

PHP Reinforce for Apache

Set up the under package deal with Apache webserver to give a boost to PHP. This package deal supplies the PHP modules for Apache 2 internet server and ONLY works with Apache’s prefork MPM.

sudo apt set up -y apache2 libapache2-mod-php8.0

PHP Reinforce for Ngnix

PHP does now not have a PHP modules package deal to give a boost to Nginx. However, we will be able to use the PHP FastCGI Procedure Supervisor to deal with requests.

sudo apt set up -y php8.0-fpm

Upon getting put in FastCGI supervisor, upload socket main points in Nginx digital host.

server https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/{

# different codes

  location ~* .php$ https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/{
    fastcgi_pass unix:/run/php/php8.0-fpm.sock;
    come with         fastcgi_params;
    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
  }
}

Set up PHP Extensions

PHP extensions permit builders to increase the features of the PHP language. At their most straightforward, extensions can give further capability that’s not natively supported through PHP (equivalent to multi-threading).

Extra difficult extensions can upload give a boost to for brand spanking new programming languages, database libraries, and even record codecs into the language itself.

As an example, putting in a PHP MySQL extension will let your PHP code connect to the MySQL database.

PHP extensions package deal is most often named like php.

To put in MySQL give a boost to for PHP v8.0, you’ll be able to set up the php8.0-mysql package deal.

sudo apt set up -y php8.0-mysql

Upon getting put in a required extension, use the under command to ensure it.

php -m | grep -i mysql

Output:

mysqli
mysqlnd
pdo_mysql

Conclusion

That’s All. I am hoping you’ve discovered set up PHP 8 on Debian 11.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More