Connect with us

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.

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.

Next, enable the Remi repository using the command:

install PHP 8.0 on CentOS 8

Once done, you can see the available PHP version for installation using the command:

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.

Step 3: Install PHP 8 on CentOS for Apache

To install PHP for Apache web server, execute the following command.

After the installation has completed, you can confirm the installation using the following command.

Step 4: Install PHP 8.0 FPM for Nginx

If you are running Nginx, you need to install PHP-FPM, using the command shown.

Next, enable FPM service to start on boot using the following command:

Once enabled, you can now start the PHP-FPM service as shown:

You can verify the status of PHP-FPM by running the command:

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:

For example, to enable the MySQL extension, run:

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.

Continue Reading
Advertisement

Trending