Kebutuhan development, kadang perlu berbagai versi PHP untuk testing. Di Fedora sendiri, cukup mudah untuk menginstall berbagai versi PHP yang masih di support oleh PHP itu sendiri.

Yang akan membedakan penggunakan versi ini adalah formatnya, bila anda terbiasa menggunakan php, untuk PHP 8 anda menggunakan php80

Install PHP 7.4

Saat ini versi PHP terbaru adalah 7.4, untuk itu kita akan menggunakan repository default Fedora 34

sudo dnf install php php-cli php-gd php-xmlrpc php-fpm \
        php-curl php-intl php-imagick php-mysqlnd php-zip php-xml \
        php-mbstring php-bcmath -y

sampai disini instalasi PHP 7.4 sudah selesai, dan bisa kita langsung untuk instalasi PHP 8.0

Install PHP 8

Fedora 34 tidak tersedia PHP 8, untuk itu kita menggunakan repository tambahan, yaitu repository Remi

sudo dnf install https://rpms.remirepo.net/fedora/remi-release-34.rpm -y
sudo dnf --enablerepo=remi install php80 -y

Install paket yang sama dengan PHP 7.4 di PHP 8.0

sudo dnf --enablerepo=remi install php80-php php80-php-cli php80-php-gd php80-php-xmlrpc php80-php-fpm \
        php80-php-curl php80-php-intl php80-php-imagick php80-php-mysqlnd php80-php-zip php80-php-xml \
        php80-php-mbstring php80-php-bcmath -y

Setelah kedua versi PHP tersebut di install, bisa dicek satu persatu

$ php -v
PHP 7.4.19 (cli) (built: May  4 2021 11:06:37) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.19, Copyright (c), by Zend Technologies
$ php80 -v
PHP 8.0.6 (cli) (built: May  4 2021 17:26:18) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.6, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.6, Copyright (c), by Zend Technologies

Leave a comment

Your email address will not be published. Required fields are marked *