Pre-requisites:
A system with CentOS Stream 9 installed and running
Access to a terminal or command line
Root or sudo privileges
First update your system
dnf update -y
Next, we need to enable the Remi repository
To install PHP 8, we’ll need to enable this repository.
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm
Next, enable PHP 8.0 Remi Module
dnf module reset php
dnf module enable php:remi-8.0
Next, install PHP 8 and some common extensions that you may need
dnf install -y php php-cli php-fpm php-json php-common php-mysqlnd php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath php-json
After the install, check the php version
php -v
Next, configure php-fpm
Start and enable php-fpm with the following commands:
systemctl start php-fpm
systemctl enable php-fpm
Ensure that php-fpm is running
systemctl status php-fpm
At the time of PHP installation, php.ini is a special file provided as a default configuration file.
To check the file path of php.ini run the command below
find ‘/’ -name “php.ini”
The -name option searches for files with a specific name
Run the following command for PHP information
php -i
Output a list of command line options with one line descriptions of what they do
php -h
List all installed PHP extensions on a Linux machine
php -m
Learn about general installation considerations on the official website
https://www.php.net/manual/en/install.general.php
Learn about the PHP command line options on the official website
https://www.php.net/manual/en/features.commandline.options.php
For information on the most current stable PHP version on the official website