Skip to main content

How To Install PHP 8.0 on Debian 11


PHP is an open-source, general-purpose scripting language that is especially suited to web development but has also been used as a general-purpose programming language.

Rasmus Lerdorf created it in 1994, then just "Personal Home Page/Forms Interpreter" and came from the merger of two similar server scripting languages: – PHP/FI (Forms Interpreter) and – PHP/quick.

In this post, we will see how to install PHP 8 on Debian 11.

Add PHP Repository

To install PHP 8 on Debian, we need to set up the SURY repository. It offers PHP 8 packages for Debian operating system.

First, update the repository cache.
sudo apt update

Install the below packages.
sudo apt install -y curl wget gnupg2 ca-certificates lsb-release apt-transport-https

Import the public using the below commands.
wget https://packages.sury.org/php/apt.gpg sudo apt-key add apt.gpg

Add the SURY repository to your system.
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php8.list

Update the repository index.
sudo apt update

Install PHP 8

Install PHP v8.0 with the following command.
sudo apt install -y php8.0 php8.0-cli php8.0-common
You can also have multiple PHP versions on your system. Each PHP version will have separate configuration files under /etc/php/{8/7}.X directory.
In case you want to install PHP v7.4, use the following command to install it.
sudo apt install -y php7.4 php7.4-cli php7.4-common

Set Default PHP Version

If your system has multiple PHP versions, You can set the default PHP version with the update-alternatives command. Change php8.0 with the version you want to set as the default PHP version.
sudo update-alternatives --set php /usr/bin/php8.0

Check PHP Version

Once you installed the PHP, check the version.
php -v

Output:
PHP 8.0.9 (cli) (built: Jul 30 2021 13:09:45) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.9, Copyright (c) Zend Technologies with Zend OPcache v8.0.9, Copyright (c), by Zend Technologies 

PHP Support for Web Server

PHP Support for Apache

Install the below package with Apache webserver to support PHP. This package provides the PHP modules for Apache 2 web server and ONLY works with Apache's prefork MPM.

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

PHP Support for Ngnix

PHP does not have a PHP modules package to support Nginx. But, we can use the PHP FastCGI Process Manager to handle requests.
sudo apt install -y php8.0-fpm

Once you have installed FastCGI manager, add socket details in Nginx virtual host.
server { # other codes location ~* \.php$ { fastcgi_pass unix:/run/php/php8.0-fpm.sock; include         fastcgi_params; fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name; fastcgi_param   SCRIPT_NAME        $fastcgi_script_name; } } 

Install PHP Extensions

PHP extensions enable developers to extend the capabilities of the PHP language. At their simplest, extensions can provide additional functionality that is not natively supported by PHP (such as multi-threading).

More complicated extensions can add support for new programming languages, database libraries, or even file formats into the language itself.

For example, installing a PHP MySQL extension will let your PHP code connect with the MySQL database.
PHP extensions package is normally named like php-.
To install MySQL support for PHP v8.0, you can install the php8.0-mysql package.
sudo apt install -y php8.0-mysql

Once you have installed a required extension, use the below command to verify it.
php -m | grep -i mysql

Output:
mysqli mysqlnd pdo_mysql

Sumber: disini

Comments

Popular posts from this blog

Cara Disable Antimalware Service Executable di Windows 10

Disadari atau tidak, Windows 10 (dan juga windows-windows lainnya) hadir dengan banyak sekali aplikasi bloatware (aplikasi yang tidak perlu-perlu amat dimiliki oleh end user). Contohnya, adalah aplikasi yang seharusnya sudah tergantikan fungsinya oleh antivirus, seperti Antimalware Service Executable . Aplikasi ini dicurigai membuat Windows 10 mengalami inefisiensi memori/RAM, memakan resource yang tinggi, dengan Load yang tinggi (tanpa limit terkadang). Nah, berikut adalah cara men-disable nya: Tekan tombol Windows + I untuk membuka apliaksi Windows Setting. Pilih icon menu Update and Security Pilih lagi menu disamping kiri Windows Security Pada jendela baru yang muncul, ada pilihan Virus & Threat protection Klik ini Lalu matikan proses Real-time protection tersebut. Dengan Regedit. Buka dialog regedit, Windows + R dan ketik ‘regedit’ Cari Folder regedit ini HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender Buat sebuah DWORD baru dengan klik kanan

Setup Debian 11 Official Repository In sources.list (/etc/apt/sources.list)

When you install Debian 11 using a DVD, the OS installer sets the DVD as the source for getting packages for your system if you didn't choose to scan for network mirrors. Due to this reason, the system would ask you to insert a DVD if the disc is not present in the DVD drive when you try to install any software.  Also, the packages on DVD may not be the latest release.  So, we need to get the packages from the Internet. Media change: please insert the disc labeled 'Debian GNU/Linux 11.0.0 _Bullseye_ - Official amd64 DVD Binary-1 20210814-10:04' in the drive '/media/cdrom/' and press [Enter] The /etc/apt/sources.list file with DVD as a source would look something like below. # deb cdrom:[Debian GNU/Linux 11.0.0 _Bullseye_ - Official amd64 DVD Binary-1 20210814-10:04]/ bullseye contrib main deb cdrom:[Debian GNU/Linux 11.0.0 _Bullseye_ - Official amd64 DVD Binary-1 20210814-10:04]/ bullseye contrib main deb http://security.debian.org/debian-security bullseye-security

Cara Berlangganan ke Akun OnlyFans

Ada dua jenis akun di OnlyFans: akun pengguna dan akun pembuat konten. Jika Anda berlangganan akun OnlyFans, maka Anda adalah pengguna. Sementara beberapa akun pembuat OnlyFans tidak mengenakan biaya untuk melihat konten mereka, yang lain dapat mengenakan biaya bulanan $50. Dalam artikel ini, kami akan menunjukkan cara berlangganan akun OnlyFans di berbagai perangkat. Kami juga akan membahas proses berlangganan akun OnlyFans tanpa kartu kredit atau debit. Cara Berlangganan Akun OnlyFans Tanpa Menggunakan Kartu Kredit Pribadi Anda Sebagai salah satu platform paling populer di industri hiburan dewasa, OnlyFans memiliki 130 juta pelanggan dan 2 juta kreator. Meskipun ada sedikit kontroversi seputar aplikasi ini, ada akun pengguna baru yang dibuat setiap hari. Jika Anda ingin membuat akun pengguna, Anda harus melakukannya di situs OnlyFans. Ingatlah bahwa Anda harus berusia minimal 18 tahun untuk membuat akun OnlyFans.