How to Install PHP on CentOS 8

Install PHP on CentOS 8

In this article, we will have explained the necessary steps to install and configure PHP on CentOS 8. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

PHP is one of the most used server side programming languages. Many popular CMS and frameworks such as WordPress, Laravel and many more are built in PHP.

Install PHP on CentOS

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

Step 2. Enable Remi repository.

Enable the Remi repository by running the following command:

Once the installation is complete, run the command to get a list of all available PHP versions:

Our Result:

The default PHP module is set to PHP 7.2. The command below will install a number of PHP extensions as well required for different integrations:

Then, install PHP and some of the most common PHP modules:

After the installation is complete, check your PHP version using the following command:

Congratulation, you have learned how to install and configure PHP on CentOS 8. If you have any question, please leave a comment below.