Linux
How to install PHP 8.0 on CentOS 8
PHP is one of the popular, general-purpose scripting languages that is suited for web development. Fast, flexible, and pragmatic, PHP powers everything from your blog to the most popular websites in the world. The latest version, PHP 8.0, was officially released on November 26th, 2020, bringing significant updates to the 25-year-old programming language. The new update comes with new features and optimizations such as union types, null safe operator, match expression, JIT, and error handling and consistency improvements. In this guide, you will learn how to install PHP 8.0 on CentOS 8.
Step 1: Update CentOS 8
To get started, ensure that your system is updated by running the commands.
1 2 |
$ sudo yum update $ sudo yum upgrade |
Step 2: Install Remi Repository
Remi repository is one of the third-party repositories that have the latest update of PHP on Enterprise Linux. To enable the Remi repository on your system, you will need to enable the EPEL repository as shown.
1 |
$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm |
Next, enable the Remi repository using the command:
1 |
$ sudo dnf -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm |
Once done, you can see the available PHP version for installation using the command:
1 |
$ sudo dnf module list php |
On the last line, you can see that PHP 8.0 is available through the Remi repository. Thereafter, reset the module and enable PHP 8.0 as shown.
1 |
$ sudo dnf module reset php |
1 |
$ sudo dnf module install php:remi-8.0 |
Step 3: Install PHP 8 on CentOS for Apache
To install PHP for Apache web server, execute the following command.
1 |
$ sudo dnf install php |
After the installation has completed, you can confirm the installation using the following command.
1 |
$ php -v |
Step 4: Install PHP 8.0 FPM for Nginx
If you are running Nginx, you need to install PHP-FPM, using the command shown.
1 |
$ sudo dnf install php-fpm |
Next, enable FPM service to start on boot using the following command:
1 |
$ sudo systemctl enable php-fpm.service |
Once enabled, you can now start the PHP-FPM service as shown:
1 |
$ sudo systemctl start php-fpm.service |
You can verify the status of PHP-FPM by running the command:
1 |
$ sudo systemctl status php-fpm.service |
Step 5: Install PHP 8 Extensions
PHP extensions are libraries that extend the functionality of PHP. There are hundreds upon hundreds of them. To install a PHP extension, use the syntax:
1 |
$ sudo dnf install php-extension_name |
For example, to enable the MySQL extension, run:
1 |
$ sudo dnf install php-mysqlnd |
Conclusion
This wraps up our topic on how to install PHP 8.0 on CentOS 8. Hopefully, you can now install PHP 8.0 on your system without a problem.
you can check how to install PHP 8.0 on Ubuntu 20.04 here.
-
DevOps55 years ago
Saltstack Tutorial for beginners [2023]
-
DevOps55 years ago
How to build a Docker cron job Container easily [2023]
-
Linux55 years ago
mail Command in Linux/Unix with 10+ Examples [2023]
-
DevOps55 years ago
Docker ADD vs COPY vs VOLUME – [2023]
-
DevOps55 years ago
How to setup Pritunl VPN on AWS to Access Servers
-
Linux55 years ago
Grep Command In Unix/Linux with 25+ Examples [2023]
-
Linux55 years ago
How To setup Django with Postgres, Nginx, and Gunicorn on Ubuntu 20.04
-
Linux55 years ago
Find command in Unix/Linux with 30+ Examples [2023]