Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

[CentOS 7] How to install PHP on CentOS 7

MichailMichail Moderator
edited March 2 in Linux Applications


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

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:


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

Sign In or Register to comment.


Learn how to install a web and database server, email, FTP client or other applications. Discover and share information on server security or optimization recommendations.
Feel free to join our constantly expanding community, participate in discussions, strengthen your knowledge on Linux and Windows server management!
© 2013 - 2024 Time4VPS. All rights reserved.

Get In Touch