How To Install PHP 8.0 on CentOS 8 | CentOS 7

Author: Saksham

Step by step guide on installing PHP 8.0 on CentOS 8 | CentOS 7

PHP 8.0 is the latest version of the popular server-side scripting language that powers many websites and web applications. In this blog post, we’ll go over how to install PHP 8.0 on CentOS 8 and CentOS 7.

Before we get started, make sure that you have a non-root user account with sudo privileges.

Installing PHP 8.0 on CentOS 8

Follow these steps to install PHP 8.0 on CentOS 8:

Step 1: Add the Remi repository

PHP 8.0 is not included in the default CentOS 8 repository. We need to add the Remi repository to get the latest version of PHP.

Use the following command to add the Remi repository:

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

Step 2: Enable the Remi repository

Once the Remi repository is added, we need to enable it. Use the following command to enable the Remi repository:

sudo dnf module reset php
sudo dnf module enable php:remi-8.0

Step 3: Install PHP 8.0

Now that the Remi repository is enabled, we can install PHP 8.0 using the following command:

sudo dnf install php

Step 4: Verify the installation

To verify that PHP 8.0 is installed and running, create a test PHP file with the following command:

sudo nano /var/www/html/info.php

Add the following code to the file:

<?php
phpinfo();
?>

Save and close the file.

Now, open a web browser and navigate to http://<your_server_ip>/info.php. You should see the PHP information page, which confirms that PHP 8.0 is installed and running.

Installing PHP 8.0 on CentOS 7

Follow these steps to install PHP 8.0 on CentOS 7:

Step 1: Add the Remi repository

Use the following command to add the Remi repository to CentOS 7:

sudo rpm -Uvh https://rpms.remirepo.net/enterprise/remi-release-7.rpm

Step 2: Enable the Remi repository

Once the Remi repository is added, we need to enable it. Use the following command to enable the Remi repository:

sudo yum-config-manager --enable remi-php80

Step 3: Install PHP 8.0

Now that the Remi repository is enabled, we can install PHP 8.0 using the following command:

sudo yum install php

Step 4: Verify the installation

To verify that PHP 8.0 is installed and running, create a test PHP file with the following command:

sudo nano /var/www/html/info.php

Add the following code to the file:

<?php
phpinfo();
?>

Save and close the file.

Now, open a web browser and navigate to http://<your_server_ip>/info.php. You should see the PHP information page, which confirms that PHP 8.0 is installed and running.

Conclusion

In this blog post, we’ve gone over how to install PHP 8.0 on CentOS 8 and CentOS 7 using the Remi repository. By following these steps, you can get the latest version of PHP up and running on your CentOS server in no time.

blog author bio

Author: Saksham

Saksham is a driven Computer Science student with a passion for programming and exploring new technologies. In his articles, he provides valuable insights of the topics, showcasing his ability to communicate complex ideas in a clear and concise manner. With strong analytical and problem-solving skills, Saksham is poised to make a significant impact in the world of Computer Science.

Share on: Share Poonam yogi blogs on twitter Share Poonam yogi blogs on facebook Share Poonam yogi blogs on WhatsApp Create Pin in Pinterest for this post

Related Posts

Comments


Please give us your valuable feedback

Your email address will not be published. Required fields are marked *

How to Install and configure Webmin on CentOS 8
How to Install and configure Webmin on CentOS 8

Webmin is an open-source control panel that allows you to manage your Linux server through an easy-to-use web interface. It allows to manage users, groups, disk quotas, create files and directories as well as configure most popular services including web, FTP, email and database servers.

Read full article
Cloud9 IDE git Installation on Debian
Cloud9 IDE git Installation on Debian

Regardless of whether you are a solitary engineer or a group with numerous designers, Cloud9 is a simple to utilise, adaptable, cloud IDE. Cloud9 might meet your requirements, as it is a self-facilitated programming bundle that permits you to create in the cloud.

Read full article
How To Fix The SSL Connection Error
How To Fix The SSL Connection Error

Fix The SSL Connection Error
In today’s digital age, security is of the utmost importance when it comes to online transactions and data transfer. SSL, which stands for “Secure Sockets Layer,” is a protocol used to make a secure connection between a web server and a web browser on a client’s computer.

Read full article
Trying to access array offset on value of type bool
Trying to access array offset on value of type bool

When upgrading php from php 7.4 to php 8.0 an error generally comes which says – “Error Trying to access array offset on value of type bool” .
There is a very simple fixes for this error.

Read full article

Some important study notes