BLACK FRIDAY SALE IS LIVE !!!!!

Need Assistance?

In only two hours, with an average response time of 15 minutes, our expert will have your problem sorted out.

Server Trouble?

For a single, all-inclusive fee, we guarantee the continuous reliability, safety, and blazing speed of your servers.

How to install PHP 8 on CentOS/RHEL 8/7

The PHP is an open-source server-side scripting language that suits to web development. The PHP finally released on November 26th, 2020 with lots of improvement and optimization.

This blog helps you to install PHP 8 on CentOS/RHEL 8/7. If you are looking for PHP installation and server management, please contact our expert team to get it done on behalf of you. you can also refer our server management plan for further assistance.

Step 1: Enable EPEL repository on CentOS

Enable the EPEL repository into your system. The EPEL provides the extra packages for enterprise Linux that are not available by default on CentOS/RHEL.

$ sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm  [On CentOS/RHEL 8]
$ sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm  [On CentOS/RHEL 7]

The Remi repository which is a third-party repository that provides wide ranges of PHP version.
Run the following commands to install the Remi repository.

$ sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm  [On CentOS/RHEL 8]
$ sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm  [On CentOS/RHEL 7]

Step 2: Install PHP 8 on CentOS/ RHEL
Once the installation is done, proceed and list the available PHP module streams.

$ sudo dnf module list PHP

Right side at the bottom, ensure to note the Remi-8.0 PHP module.

Enable the module before installing the PHP 8.0. To enable the PHP: Remi-8.0 execute the following command.

Install PHP 8.0 for Apache.

Run the following command to executive the 8.0 for Apache.

$ sudo dnf install php php-cli php-common

Installing PHP 8.0 for Nginx

$ sudo dnf install php php-cli php-common php-fpm

Step 3: Verify php 8.0 on centOS/RHEL

$ php -v

Add the following PHP code to populate the version of PHP.

<?php

phpinfo();

?>

Add and exit and ensure to restart the Apache or Nginx web server.

$ sudo systemctl restart httpd
$ sudo systemctl restart nginx

Paste the URL on the browser and go to the address shown.

http://server-ip/info.php

It displays a website that consists of information regarding the PHP that has been installed.

Step 4: Install PHP 8.0 extentions in centOS/RHEL

Use the following commands to verify the installed PHP extensions.

$ sudo dnf install php-{extension-name}

Finally, you can verify the installed extensions by following the command:

$ php -m

Execute, to verify specific extensions is installed.

$ php -m | grep extension-name

For example:

$ php -m | grep mysqlnd

Conclusion: 

This blog will help you to install the PHP 8.0 alongside various PHP extensions on Centos/RHEL. Follow the step if any error occurs you can contact our technical team support available 24/7 for any assistance.

Liked!! Share the post.

Get Support right now!

Start server management with our 24x7 monitoring and active support team

Can't get what you are looking for?

Available 24x7 for emergency support.