How to Install Apache with PHP 8 on CentOS 7

2023-09-28 17:56:35
Performance-Optimized Fast Internet Integrations - POFII

Introduction

Apache is a popular open-source, cross-platform web server software. PHP is a widely-used open-source scripting language designed for web development. In this guide, we'll show you how to install Apache along with PHP 8 on a CentOS 7 server.

Prerequisites

Before you begin, make sure you have a CentOS 7 server with a non-root user with sudo privileges.

Installation of Apache

1. Update Your System

First, update your package lists for upgrades and new package installations:

$ sudo yum update -y

2. Install Apache

Next, install Apache using the following command:

$ sudo yum install httpd -y

3. Start and Enable Apache

Once the installation is complete, start the Apache service and enable it to start on boot using the following commands:

$ sudo systemctl start httpd
$ sudo systemctl enable httpd

Installation of PHP 8

1. Enable EPEL and Remi Repository

EPEL and Remi repositories contain the PHP 8 package. Enable them using the following commands:

$ sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y
$ sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y

2. Install PHP 8

Install PHP 8.0 and some common PHP extensions:

$ sudo yum install php80-php php80-php-pear php80-php-bcmath php80-php-pecl-jsond-devel php80-php-pecl-jsond php80-php-pecl-zip php80-php-mysqlnd -y

Conclusion

Congratulations! You've successfully installed Apache with PHP 8 on your CentOS 7 system. Now, you can start building your PHP web applications served via the Apache web server.

0

Was this answer helpful?