Dec 20, 2022
.
Admin
Hi Dev,
Now, let's see article of how to install php 8.0 on centos 8. I explained simply about 4 easy steps to install php on centos 8. We will look at example of install php 8 on centos 8 linux. I would like to share with you install and use php 8 on centos 8 / rhel 8.
Just follow the following steps to install and configure PHP 8.x on CentOS 8:
Step 1: Enable the Remi repository
Open terminal or command line and execute the following command into it to enable the remi repository in centOS 8:
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
sudo dnf module enable php:remi-8.0 -y
Once the remi repository installation is complete, execute the following command on terminal or command line to get a list of all available PHP versions:
sudo dnf module list php
Step 2: Installing PHP 8 on CentOS
Execute the following command on the command line to install PHP 8 on CentOS:
sudo dnf install php php-opcache php-gd php-curl php-mysqlnd
FPM is installed as a dependency and used as a FastCGI server. Start the FPM service and enable it to automatically start on boot:
sudo systemctl enable --now php-fpm
Step 3: Install Apache with PHP 8 on CentOS
The following command on terminal or command line to Apache web server on our system:
sudo dnf install httpd -y
Step 4: Configuring PHP to work with Apache
Apache as web server on our system, so restart the httpd service using the following command:
sudo systemctl restart httpd
Lets create php info file on your CentOS server. The default virtulhost uses /var/www/html as document root. So create a file under this directory:
echo "<?php phpinfo(); ?>" > /var/www/html/info.php
I hope it could help you...
#PHP