Introduction
PHP (Hypertext Preprocessor) is a server-side programming language that was created specifically for web development (websites, web applications and other projects). Its main advantage over other languages is the ability to embed PHP code directly into HTML.
In this tutorial, we will install the PHP 8.3 version. However, you can install a different version by following the given steps.
Installation guide
1. Update The System
First, update the packages:
yum update
2. Add Remi RPM Repository
To add the remi RPM repository, run this command:
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
3. Install The Yum-Utils
To install yum-utils, run the following command:
yum install yum-utils
Then, verify that the "yum-config-manager" is available on the server:
yum-config-manager
4. Enable Remi RPM Repository
To enable the remi RPM repository, run the following command (if you want to install a different version of PHP, enter the desired version number instead of "83", for example php80 or php81)
yum-config-manager --enable remi-php83
5.Repeat The System Update
Then you need update the system again:
yum update
6. Install The PHP
To install PHP, run the following command
yum install php
7. Check PHP
After PHP is installed, you can check it by running this command:
php -v
If everything was done correctly, the command will show general information about installed PHP version:
PHP extensions
To install PHP extension, you should run this command (change the "extension_name" to the actual extension you want to install")
yum install php-extension_name
For example:
yum install php-opcache
If you want to install multiple extensions at the same time, simply list all the required extensions after the "yum install" command:
yum install php-fpm php-curl php-cli php-json php-mysql php-opcache php-dom
To list all installed PHP extensions, run the following command:
php -m