Rocky Linux 8 is a popular choice for businesses looking for a stable and secure operating system for their servers. One of the key components of a server is the programming language used to develop web applications. PHP is a widely used language, and installing the latest version, PHP 8, on Rocky Linux 8 can provide significant performance improvements and new features. In this article, we will guide you through the process of installing PHP 8 on Rocky Linux 8, step by step.
1. Introduction
PHP is a server-side scripting language used to build dynamic web pages and applications. It is known for its flexibility, ease of use, and extensive community support. With the release of PHP 8, developers can take advantage of new features and performance enhancements. In this article, we will walk you through the process of installing PHP 8 on Rocky Linux 8, allowing you to leverage the benefits of this latest version.
2. Prerequisites
Before we begin, make sure you have the following prerequisites in place:
- A server running Rocky Linux 8
- SSH access to the server with administrative privileges
- Stable internet connection
Now that we have the prerequisites covered, let’s proceed with the installation process.
3. Adding EPEL and REMI Repositories
To install PHP 8, we need to add the EPEL (Extra Packages for Enterprise Linux) and REMI repositories to Rocky Linux 8. These repositories contain additional packages and software that are not available in the default Rocky Linux repositories.
To add the EPEL repository, run the following command:
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Next, add the REMI repository by executing the following command:
yum -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
With the repositories added, we can now proceed to install the YUM utilities.
4. Installing YUM Utilities
YUM utilities are a collection of tools that enhance the package management capabilities of the YUM package manager. We need these utilities to enable the PHP 8 Remi repository and install PHP 8. To install the YUM utilities, run the following command:
yum -y install yum-utils
Now that we have the YUM utilities installed, let’s move on to enabling the PHP 8 Remi repository.
5. Enabling PHP 8 Remi Repository
The PHP 8 Remi repository contains the latest version of PHP 8 and its associated packages. To enable the PHP 8 Remi repository, we need to reset the PHP module and then install the PHP module for the Remi repository.
Reset the PHP module by executing the following command:
yum module reset php
Next, install the PHP 8 module for the Remi repository with the following command:
yum module install php:remi-8.0
Once the installation is complete, you will see the output displaying the packages that were installed. These packages include php-cli, php-common, php-fpm, php-mbstring, and php-xml, among others.
6. Installing PHP 8
Now that we have enabled the PHP 8 Remi repository, we can proceed with installing PHP 8 on Rocky Linux 8. To install PHP 8, simply run the following command:
yum install php
The installation process will resolve any dependencies and download the necessary packages. Once the installation is complete, you will have PHP 8 installed on your Rocky Linux 8 server.
7. Checking PHP Version
To verify that PHP 8 has been successfully installed, you can check the PHP version by running the following command:
php -v
The output should display the PHP version, along with other details such as the build date and the Zend Engine version. If you see the PHP 8 version information, congratulations! You have successfully installed PHP 8 on your Rocky Linux 8 server.
8. Conclusion
In this article, we have walked you through the process of installing PHP 8 on Rocky Linux 8. By adding the EPEL and REMI repositories, installing YUM utilities, and enabling the PHP 8 Remi repository, you were able to install PHP 8 on your Rocky Linux 8 server. We also showed you how to check the PHP version to ensure that the installation was successful.
Now that you have PHP 8 installed, you can take advantage of its new features and performance improvements to develop powerful web applications. If you have any questions or run into any issues during the installation process, feel free to reach out to our support team at Shape.host. We are here to help you make the most out of your Linux SSD VPS hosting experience.