Cara install PHP 8.0 di Debian 9/10/11

Panduan cara install PHP 8.0 di Debian 9, 10 dan 11 serta extension PHP yang umum digunakan oleh website berbasis WordPress.

Membuat bash script untuk menambahkan paket PHP repository deb.sury.org

nano sury.sh

Isi dengan script berikut

#!/bin/sh
# To add this repository please do:

if [ "$(whoami)" != "root" ]; then
    SUDO=sudo
fi

${SUDO} apt-get update
${SUDO} apt-get -y install apt-transport-https lsb-release ca-certificates curl
${SUDO} curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
${SUDO} sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
${SUDO} apt-get update

CHMOD script bash tersebut

chmod 755 sury.sh

Eksekusi

./sury.sh

Install PHP 8.0

Berikut ini perintah untuk menginstall paket PHP 8.0 beserta extensionnya

apt install php8.0 -y
apt install php8.0-bz2 -y
apt install php8.0-curl -y
apt install php8.0-gd -y
apt install php8.0-imap -y
apt install php8.0-intl -y
apt install php8.0-imagick -y
apt install php8.0-mbstring -y
apt install php8.0-mysql -y
apt install php8.0-odbc -y
apt install php8.0-opcache -y
apt install php8.0-tidy -y
apt install php8.0-xsl -y
apt install php8.0-xml -y
apt install php8.0-xmlrpc -y
apt install php8.0-soap -y
apt install php8.0-zip -y

Install module Apache

Jika Anda menggunakan mod_php

apt install libapache2-mod-php8.0

Jika menggunakan PHP-FPM (FastCGI Process manager) install dan enable module Apache fcgid ini

apt install php8.0-fpm libapache2-mod-fcgid -y
a2enmod proxy_fcgi setenvif
a2enconf php8.0-fpm

Install PHP-FPM untuk Nginx

apt install php8.0-fpm -y

Selesai, semoga bermanfaat.

Add a comment