Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install php-fpm in php7

2025-02-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to install php-fpm in php7". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to install php-fpm in php7.

Php7 php-fpm installation configuration method: 1, install PHP7 suite and plug-ins; 2, create socket descriptor file; 3, modify php-fpm configuration file; 4, restart php-fpm.

This article operating environment: centos7 system, PHP7.1 version, Dell G3 computer.

How to install php-fpm in php7?

Install php7.1 and php-fpm (centos7, nginx)

Delete the old version of php

# yum remove php-common

Second, install php

Details: https://wiki.centos.org/zh-tw/HowTos/php7?highlight=%28php7%29

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

There are two ways to configure communication using php-fpmnginx and fastcgi, one is TCP, the other is unix socke

TCP is using the TCP port to connect to 127.0.0.1 9000

Socket uses unix domain socket connection sockets

1. TCP configuration method

Edit / etc/nginx/conf.d/ your site profile. Modify the fastcgi_pass parameter to 127.0.0.1 virtual 9000

Edit 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

The value of listen is set to 127.0.0.1 9000, which is the same as the value of the fastcgi_pass parameter in the site configuration file

When finished, we must change the selinux database and add port 9000 to a valid connection for httpd services.

Semanage port-a-t http_port_t-p tcp 9000

Restart php-fpm, restart nginx

2, unix socket configuration file (usually .sock) as the unique identity of socket (descriptor), the two processes that need to communicate refer to the same socket descriptor file to establish a channel for communication.

Create a socket descriptor file

Sudo touch / var/run/php7.1-fpm.socksudo chown nginx:nginx / var/run/php7.1-fpm.socksudo chmod 666 / var/run/php7.1-fpm.sock

Modify the php-fpm configuration file

Set the values of user and group 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 semicolons before listen.owner, listen.group, and listen.mode to make php-fpm use unix socket, and set the values of listen.owner and listen.group to nginx

Listen.owner = nginx

Listen.group = nginx

Modify the nginx site configuration file. Edit / etc/nginx/conf.d/ your site profile. Modify the fastcgi_pass parameter to / var/run/php7.1-fpm.sock

Restart nginx and php-fpm services (preferably restart php-fpm and then restart nginx)

Thank you for reading, the above is the content of "how to install php-fpm in php7". After the study of this article, I believe you have a deeper understanding of how to install php-fpm in php7, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report