PHP Packages for HTTPD on RHEL-Like Distros

Target Systems: Oracle Enterprise Linux 8 (OEL8) and CentOS 8

Core PHP Packages

sudo dnf install -y php php-common php-cli

HTTPD Integration

sudo dnf install -y php-fpm httpd

Essential PHP Modules

php-mysqlnd - MySQL/MariaDB database support
php-pdo - PHP Data Objects interface
php-gd - GD graphics library
php-mbstring - Multibyte string handling
php-xml - XML processing
php-json - JSON support
php-opcache - Opcode cache for performance
php-intl - Internationalization functions
php-bcmath - Arbitrary precision mathematics
php-zip - ZIP archive handling
php-curl - cURL support
php-soap - SOAP protocol support
php-ldap - LDAP directory access
php-process - Process control extensions
php-pecl-apcu - User cache for PHP

One-Line Install Command

sudo dnf install -y httpd php php-common php-cli php-fpm php-mysqlnd php-pdo php-gd php-mbstring php-xml php-json php-opcache php-intl php-bcmath php-zip php-curl php-soap php-ldap php-process php-pecl-apcu

Post-Installation Steps

# Enable and start PHP-FPM
sudo systemctl enable php-fpm
sudo systemctl start php-fpm

# Enable and start HTTPD
sudo systemctl enable httpd
sudo systemctl start httpd

# Configure firewall
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload

# Verify PHP version
php -v

Optional/Additional Packages

php-pgsql - PostgreSQL database support
php-odbc - ODBC database support
php-pear - PHP Extension and Application Repository
php-devel - PHP development files
php-pecl-zip - Enhanced ZIP support
php-imap - IMAP email support
php-enchant - Spell checking
php-snmp - SNMP support
Note: OEL8 and CentOS 8 use php-fpm (FastCGI Process Manager) by default instead of mod_php. This is more efficient and secure.

Configuration Files

/etc/php.ini - Main PHP configuration
/etc/php-fpm.d/www.conf - PHP-FPM pool configuration
/etc/httpd/conf.d/*.conf - HTTPD PHP configuration

Test PHP Installation

# Create test file
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php

# Visit in browser
# http://your-server-ip/info.php

# Remove after testing
sudo rm /var/www/html/info.php
← Back to LAMPS Index ↑ Back to EXPANDED