How to Install PHP on CentOS 8


Easily deploy your favorite applications in seconds at an unbeatable price for your next projects.

Installing PHP on CentOS 8

PHP is a popular server-side scripting language that is widely used to create dynamic web pages and applications. It allows developers to embed PHP code within HTML, providing a powerful and flexible solution for web development.

Step 1: Update Package Repository

It is important to start by updating the package repository on your CentOS 8 server. This ensures that you have access to the latest available software packages.

sudo dnf update


Step 2: Enable REMI Repository

The REMI repository provides the latest versions of PHP and related packages. Enable the REMI repository on your CentOS 8 server.

sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm


Step 3: Install PHP

Install PHP on your CentOS 8 server using the following command:

sudo dnf install php


Step 4: Verify PHP Installation

Once the installation is complete, you can verify PHP by creating a simple PHP information file:

sudo nano /var/www/html/info.php
Add the following lines to the file:
Save the file and exit the text editor.


Step 5: Restart Apache

Restart the Apache web server to apply the changes:

sudo systemctl restart httpd


Step 6: Test PHP Configuration

Open a web browser and navigate to http://your_server_ip/info.php. You should see a page displaying detailed information about your PHP setup.


Congratulations! You have successfully installed PHP on CentOS 8. You can now start developing dynamic web applications using PHP and leverage its vast ecosystem of libraries and frameworks.

Refer A Friend
Get $25

installing PHP on CentOS 8

Why Customers Love Us

What our customers say about us

Ready To Get Started For Free?

Create your free account today.