Home  >  Article  >  Backend Development  >  How to install PHP via yum and enable FPM mode

How to install PHP via yum and enable FPM mode

PHPz
PHPzOriginal
2023-04-21 09:07:021030browse

1. Background introduction

In Linux systems, yum is one of the main ways to manage and install software packages. PHP is a commonly used Web programming language, and FPM is a PHP operating mode that can improve the performance and stability of the Web server. This article will detail how to install PHP through yum and enable FPM mode.

2. Install PHP with yum

  1. Preparation work

First, the list of software packages that need to be upgraded to the system:

sudo yum update
  1. Install PHP

Use yum to install PHP, you can use the following command:

sudo yum install php

During the installation process, you will be prompted whether to continue. Just enter y and press Enter.

  1. Verify PHP installation

After the installation is completed, you can verify whether PHP is installed correctly by running the following command:

php -version

If the PHP version number is displayed correctly, please indicate PHP has been installed correctly.

3. Enable FPM mode

  1. Install FPM

You can use the following command to install FPM:

sudo yum install php-fpm

During the installation process, there will be Prompt whether to continue. Just enter y and press Enter.

  1. Configuring FPM

After the installation is complete, you need to edit the PHP FPM configuration file and find the following two settings:

;listen = 127.0.0.1:9000
;listen = /run/php-fpm/php-fpm.sock

By default, the One line is commented out, the second line is uncommented and set up to listen to the Unix Socket. If you want to use TCP/IP port listening, just uncomment the first line. For example, change the first line to:

listen = 127.0.0.1:9000
  1. Start FPM

After configuring FPM, you need to start FPM to run. Run the following command:

sudo systemctl start php-fpm
  1. Verify FPM

Run the following command to view the port FPM is listening on:

sudo netstat -anp | grep php-fpm

If it starts successfully, you should be able to See the port you are listening on.

4. Summary

Using yum to install PHP is a convenient and fast way. Enabling FPM mode can improve the performance and stability of the web server. This article introduces the process from installing PHP to enabling FPM in detail. I hope it will be helpful to readers.

The above is the detailed content of How to install PHP via yum and enable FPM mode. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn