How to install and configure php-fpm in php7: 1. Install the PHP7 suite and plug-ins; 2. Create a socket descriptor file; 3. Modify the php-fpm configuration file; 4. Restart php-fpm.
The operating environment of this article: centos7 system, PHP version 7.1, Dell G3 computer.
How to install php-fpm in php7?
Install php7.1 and php-fpm (centos7, nginx)
1. Delete the old version of php
#yum remove php-common
2. Install php
Details: https://wiki.centos.org/zh-tw/HowTos/php7?highlight=(php7)
First, install the software library (it is an official software library that needs to be started).
# yum -y install centos-release-scl.noarch
Install the PHP 7 suite and its plug-ins.
\ # yum -y install rh-php70 rh-php70-php rh-php70-php-fpm
3. Configure using php-fpm
nginx and fastcgi There are two communication methods, one is TCP method, and the other is unix socket method
- TCP uses TCP port to connect 127.0.0.1:9000
- Socket uses unix domain Socket connection socket
1. TCP configuration method
- Edit /etc/nginx/conf.d/your site configuration file. Modify the fastcgi_pass parameter to 127.0.0.1:9000
- Edit the php-fpm configuration file /etc/opt/rh/rh-php71/php-fpm.d/www.conf
- Set the values of user and group to nginx
user = nginx
group = nginx
- listen value setting is 127.0.0.1:9000, which is the same as the value of the fastcgi_pass parameter in the site configuration file
- After completion, we must change the selinux database and add port 9000 to serve httpd Valid connection.
semanage port -a -t http_port_t -p tcp 9000
- Restart php-fpm, restart nginx
2. Unix socket configuration method
Use a file (usually .sock) as the unique identifier (descriptor) of the socket. Two processes that need to communicate can establish a channel for communication by referencing the same socket descriptor file. .
- Create socket descriptor file
sudo touch /var/run/php7.1-fpm.sock sudo chown nginx:nginx /var/run/php7.1-fpm.sock sudo chmod 666 /var/run/php7.1-fpm.sock
- Modify the php-fpm configuration file
- The values of user and group are set to nginx
user = nginx
group = nginx
- The value of listen is set to /var/run/php7. 1-fpm.sock, which is the same as the value of the fastcgi_pass parameter in the site configuration file
- Remove the semicolon in front of listen.owner, listen.group, and listen.mode to make php-fpm use unix socket and change The values of listen.owner and listen.group are set to nginx
listen.owner = nginx
listen.group = nginx
- Modify the nginx site configuration file. Edit /etc/nginx/conf.d/your site configuration file. Change the fastcgi_pass parameter to /var/run/php7.1-fpm.sock
- Restart nginx and php-fpm services (it is best to restart php-fpm first and then restart nginx) [Recommended learning: PHP Video tutorial】
The above is the detailed content of How to install php-fpm in php7. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version
Useful JavaScript development tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1
Powerful PHP integrated development environment