PHP is the dominant server-side scripting language powering WordPress, Laravel, Drupal, Magento, and thousands of other web applications. RHEL 9 ships with PHP 8.1 by default, but the Remi repository provides the latest PHP releases including PHP 8.3. PHP 8.3 introduced typed class constants, new json_validate() function, and further performance improvements over PHP 8.2. The PHP extensions ecosystem includes database drivers (PDO MySQL, PDO PostgreSQL, Redis), image processing (GD, Imagick), caching (OPcache, APCu), and security (OpenSSL, Sodium). This guide covers installing PHP 8.3 on RHEL 9 from the Remi repository, enabling the most common extensions, configuring PHP-CLI and PHP-FPM, and verifying the installation.

Prerequisites

  • RHEL 9 with sudo/root access

Step 1 — Enable EPEL and Remi Repository

# EPEL is required by Remi
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm

# Enable PHP 8.3 module from Remi
dnf module reset php -y
dnf module enable php:remi-8.3 -y

Step 2 — Install PHP 8.3 and Common Extensions

dnf install -y 
    php 
    php-cli 
    php-fpm 
    php-common 
    php-opcache 
    php-mysqlnd 
    php-pdo 
    php-pgsql 
    php-xml 
    php-json 
    php-mbstring 
    php-zip 
    php-gd 
    php-curl 
    php-intl 
    php-bcmath 
    php-sodium 
    php-pecl-redis 
    php-pecl-apcu

php --version

Step 3 — Configure PHP CLI

# /etc/php.ini — key settings for security and performance
; Memory limit for CLI scripts
memory_limit = 512M

; Maximum script execution time
max_execution_time = 120

; File upload limits
upload_max_filesize = 64M
post_max_size = 64M

; Error reporting for development (set to 0 or E_ALL & ~E_DEPRECATED for production)
display_errors = Off
log_errors = On
error_log = /var/log/php_errors.log

; Timezone
date.timezone = UTC

Step 4 — Configure OPcache

# /etc/php.d/10-opcache.ini — production OPcache settings
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.validate_timestamps=0   ; Set to 1 in development for auto-reload
opcache.revalidate_freq=0
opcache.fast_shutdown=1

Step 5 — Start PHP-FPM

systemctl enable --now php-fpm
systemctl status php-fpm

# Test PHP CLI
php -r "echo PHP_VERSION . PHP_EOL;"

# List installed extensions
php -m | sort

Step 6 — Verify PHP Info

# Create a phpinfo() file in web root for verification (remove after checking!)
echo ' /var/www/html/info.php
# Visit: http://your-server/info.php
# REMOVE after verifying — phpinfo() exposes sensitive server configuration
rm -f /var/www/html/info.php

Conclusion

PHP 8.3 on RHEL 9 installed from the Remi repository provides the latest PHP features, security patches, and performance improvements unavailable in the default RHEL PHP packages. OPcache is the most impactful PHP performance setting — it compiles and caches bytecode in memory, eliminating script parsing on every request. For web deployments, use PHP-FPM with Nginx or Apache rather than the mod_php module; PHP-FPM provides better process isolation, configurable per-pool limits, and supports high-concurrency applications.

Next steps: How to Install Composer on RHEL 9, How to Configure PHP-FPM with Nginx on RHEL 9, and How to Harden PHP on RHEL 9.