Home > Backend Development > PHP Tutorial > PHP-FPM cannot generate .sock file

PHP-FPM cannot generate .sock file

WBOY
Release: 2016-09-15 11:30:56
Original
3214 people have browsed it

Install php 5.6 on yum on centos7

<code>vim /etc/php-fpm.d/www.conf
</code>
Copy after login
Copy after login

Modification

<code>;listen = 127.0.0.1:9000
listen=/dev/shm/php-fcgi.sock</code>
Copy after login
Copy after login

Create php-fcgi.sock file

<code>touch listen=/dev/shm/php-fcgi.sock
chmod 777 /dev/shm/php-fcgi.sock</code>
Copy after login
Copy after login

Restart php-fpm

<code>systemctl restart php-fpm</code>
Copy after login
Copy after login

But /dev/shm/php-fcgi.sock is still an ordinary file, not a socket file. Check the log and there is no error. How to solve it?

Reply content:

Install php 5.6 on yum on centos7

<code>vim /etc/php-fpm.d/www.conf
</code>
Copy after login
Copy after login

Modification

<code>;listen = 127.0.0.1:9000
listen=/dev/shm/php-fcgi.sock</code>
Copy after login
Copy after login

Create php-fcgi.sock file

<code>touch listen=/dev/shm/php-fcgi.sock
chmod 777 /dev/shm/php-fcgi.sock</code>
Copy after login
Copy after login

Restart php-fpm

<code>systemctl restart php-fpm</code>
Copy after login
Copy after login

But /dev/shm/php-fcgi.sock is still an ordinary file, not a socket file. Check the log and there is no error. How to solve it?

Delete ordinary files. When running in Unix Socket mode, sock files are created by php-fpm

Isn’t it written in the configuration file? php-fpm will generate this socket file by itself and be referenced by the master process

<code>; The address on which to accept FastCGI requests.
; Valid syntaxes are:
;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific IPv4 address on
;                            a specific port;
;   '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
;                            a specific port;
;   'port'                 - to listen on a TCP socket to all IPv4 addresses on a
;                            specific port;
;   '[::]:port'            - to listen on a TCP socket to all addresses
;                            (IPv6 and IPv4-mapped) on a specific port;
;   '/path/to/unix/socket' - to listen on a unix socket.
</code>
Copy after login

I feel like the configuration is written wrong.

php-fpm.conf

<code>listen = /dev/shm/php-fcgi.sock
listen.owner = www
listen.group = www
listen.mode = 0660</code>
Copy after login

nginx.conf

<code>fastcgi_pass unix:/dev/shm/php-fcgi.sock;</code>
Copy after login
Related labels:
php
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