How to install php fpm

PHPz
Release: 2023-05-06 11:45:07
Original
1583 people have browsed it

PHP FPM is a FastCGI process manager for PHP that can handle high-traffic websites and improve performance. In this article, we will show you how to install PHP FPM.

Installing PHP FPM

PHP FPM is shipped with PHP, so by default, no separate installation is required. However, if you are using Linux, you need to install the FPM package. To install run the following commands:

Debian/Ubuntu:

sudo apt-get install php-fpm

CentOS/RHEL:

sudo yum install php-fpm

Start PHP FPM

Once you have installed PHP FPM, you can start it using the following command:

sudo systemctl start php-fpm

You can check the status of FPM using the following command:

sudo systemctl status php-fpm

If FPM is running, you should see the message "active (running)".

Configuration PHP FPM

By default, PHP FPM uses the configuration file "/etc/php/fpm/php-fpm.conf". You can open the file with a text editor to make changes.

For example, you can change the following setting:

listen = /run/php/php7.4-fpm.sock
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35

This configuration file configures PHP FPM to use Unix sockets for communication and sets max_children to 50 in order to handle more ask.

Related files:

  • /etc/php/fpm/php.ini - PHP configuration file
  • /etc/php/fpm/pool.d/www .conf - PHP FPM default configuration file

Restart PHP FPM

The command to restart PHP FPM to apply configuration changes is as follows:

sudo systemctl restart php-fpm

Stop PHP FPM

To stop the PHP FPM service, run the following command:

sudo systemctl stop php-fpm

Summary

Leveraging PHP FPM can take the performance of your PHP applications to the next level. In this article, we show you how to install PHP FPM, and configure it to optimize performance.

The above is the detailed content of How to install php fpm. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!