How to Install PHP 8.2 in Rocky Linux 9
PHP is a script language and interpreter that is freely available and used primarily on Linux Web servers.
To install PHP 8.2, we’ll need to add/enable the Remi RPM repositories which contain the PHP 8.2 packages that we need.
Pre-requisites :
-
A system with Rocky Linux 9 installed and running.
- root access to the system.
To add EPEL and REMI Repository.
dnf install epel-release
dnf install http://rpms.remirepo.net/enterprise/remi-release-9.rpm
To install dnf utilities.
dnf install dnf-utils
To enable php 8.2 Remi repository.
dnf module reset php
and
dnf module install php:remi-8.2
Output:
[root@vps ~]# dnf module install php:remi-8.2
Last metadata expiration check: 0:01:05 ago on Tue 13 Dec 2022 07:49:41 AM UTC.
Dependencies resolved.
=======================================================================================================================================
Package Architecture Version Repository Size
=======================================================================================================================================
Installing group/module packages:
php-cli x86_64 8.2.0-1.el9.remi remi-modular 5.3 M
php-common x86_64 8.2.0-1.el9.remi remi-modular 831 k
php-fpm x86_64 8.2.0-1.el9.remi remi-modular 1.8 M
php-mbstring x86_64 8.2.0-1.el9.remi remi-modular 574 k
php-xml x86_64 8.2.0-1.el9.remi remi-modular 204 k
Installing dependencies:
httpd-filesystem noarch 2.4.53-7.el9 appstream 15 k
libxslt x86_64 1.1.34-9.el9 appstream 240 k
oniguruma5php x86_64 6.9.8-1.el9.remi remi-safe 219 k
Installing weak dependencies:
nginx-filesystem noarch 1:1.20.1-13.el9 appstream 11 k
Installing module profiles:
php/common
Enabling module streams:
php remi-8.2
Transaction Summary
=======================================================================================================================================
Install 9 Packages
To install any remaining updates.
dnf update
Install PHP
Now, installing PHP is a breeze and similar to normal package installation.
dnf install php
Output:
[root@vps ~]# dnf install php
Last metadata expiration check: 0:01:28 ago on Tue 13 Dec 2022 07:49:41 AM UTC.
Dependencies resolved.
=======================================================================================================================================
Package Architecture Version Repository Size
=======================================================================================================================================
Installing:
php x86_64 8.2.0-1.el9.remi remi-modular 1.8 M
Installing dependencies:
apr x86_64 1.7.0-11.el9 appstream 123 k
apr-util x86_64 1.6.1-20.el9 appstream 94 k
apr-util-bdb x86_64 1.6.1-20.el9 appstream 13 k
httpd-core x86_64 2.4.53-7.el9 appstream 1.4 M
httpd-tools x86_64 2.4.53-7.el9 appstream 82 k
libsodium x86_64 1.0.18-8.el9 epel 161 k
mailcap noarch 2.1.49-5.el9 baseos 32 k
Installing weak dependencies:
apr-util-openssl x86_64 1.6.1-20.el9 appstream 15 k
php-opcache x86_64 8.2.0-1.el9.remi remi-modular 602 k
php-pdo x86_64 8.2.0-1.el9.remi remi-modular 117 k
php-sodium x86_64 8.2.0-1.el9.remi remi-modular 61 k
Transaction Summary
=======================================================================================================================================
Install 12 Packages
Total download size: 4.4 M
Installed size: 14 M
Is this ok [y/N]: y
NOTE: It will prompt for permission type y and press Enter to proceed with the installation.
Check PHP Version.
php -v
Output:
[root@vps ~]# php -v
PHP Warning: PHP Startup: ^(text/|application/xhtml\+xml) (offset=0): unrecognised compile-time option bit(s) in Unknown on line 0
PHP 8.2.0 (cli) (built: Dec 6 2022 14:26:47) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.2.0, Copyright (c) Zend Technologies
with Zend OPcache v8.2.0, Copyright (c), by Zend Technologies
While installing any CMS applications such as WordPress, Drupal, Joomla etc, you will need to install additional PHP modules. For this, use the below command to install the required modules,
dnf -y install php -{cli,gd,mysqlnd,mbstring,json,common,dba,dbg,devel,embedded,enchant,bcmath,gmp,intl,ldap,odbc,pdo,opcache,pear,pgsql,process,snmp,soap,xml,,opcache}
This concludes our topic of installing PHP 8.2 on the Rocky Linux 9 System.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS