php php7.0-fpm.sock 在哪里
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44757189/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where is php7.0-fpm.sock located
提问by hidar
I have a simple project with directory structure
我有一个带有目录结构的简单项目
I am setting up nginx config for my drupal site, and for the fastcgi_pass
I have been using 127.0.0.1:9000
but I want to use a unix socket as suggested in this conf:
我正在为我的 drupal 站点设置 nginx 配置,并且对于fastcgi_pass
我一直在使用的站点,127.0.0.1:9000
但我想按照此 conf 中的建议使用 unix 套接字:
# PHP 7 socket location.
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
but I can't find php/php7.0-fpm.sock;
但我找不到 php/php7.0-fpm.sock;
I have the following path in my centos distro
我的 centos 发行版中有以下路径
/var/run/php-fpm/php-fpm.pid
回答by BenRoob
Check the php-fpmconfig where the socket will be created with:
检查将在其中创建套接字的php-fpm配置:
$ cat /etc/php/7.0/fpm/pool.d/www.conf
$ cat /etc/php/7.0/fpm/pool.d/www.conf
Look for listen
, for example:
寻找listen
,例如:
listen = /run/php/php7.0-fpm.sock
listen = /run/php/php7.0-fpm.sock
php-fpmcreates the socket file afteryou started the process.
php-fpm在您启动进程后创建套接字文件。
sudo service php7.0-fpm stop
sudo service php7.0-fpm start
Check the directory if socket file was created:
如果创建了套接字文件,请检查目录:
$ cd /run/php && ls -la
$ cd /run/php && ls -la
回答by nbari
First check if php-fpm
is running on your system, for doing this you could use pgrep
for example:
首先检查是否php-fpm
正在您的系统上运行,为此您可以使用pgrep
例如:
# pgrep -fa php-fpm
5666 php-fpm: master process (/etc/php-fpm.conf)
5667 php-fpm: pool www
5668 php-fpm: pool www
5669 php-fpm: pool www
5670 php-fpm: pool www
5671 php-fpm: pool www
In this case, it shows is up and running and using the configuration file /etc/php-fpm.conf
. Before checking the configuration file and trying to check for the listen =
directive you could quickly look into /proc/net/unix
for example:
在这种情况下,它显示已启动并正在运行并使用配置文件/etc/php-fpm.conf
。在检查配置文件并尝试检查listen =
指令之前,您可以快速查看/proc/net/unix
例如:
# grep php /proc/net/unix
Which may return something like:
这可能会返回如下内容:
ffff8800bfb2f400: 00000002 00000000 00010000 0001 01 28561 /tmp/php-fpm.sock
In this case, it shows that the path for the php-fpm socket is located in /tmp/php-fpm.sock
the one could be verified by checking the conf in /etc/php-fpm.d/www.conf
in this case being: listen= /tmp/php-fpm.sock
在这种情况下,它表明 php-fpm 套接字的路径位于/tmp/php-fpm.sock
可以通过/etc/php-fpm.d/www.conf
在这种情况下检查 conf 来验证的路径:listen= /tmp/php-fpm.sock
In case you don't get any result and php-fpm
is up and running, by checking the configuration you may find that is using the defaults by listing on a TCP socket:
如果您没有得到任何结果并且php-fpm
正在运行,通过检查配置,您可能会发现通过在 TCP 套接字上列出来使用默认值:
listen = 127.0.0.1:9000
Something you could change to listen on a Unix socket like your suggested conf:
您可以更改为在 Unix 套接字上进行监听,例如您建议的 conf:
listen = /var/run/php/php7.0-fpm.sock
In some Linux distros normally this is used:
在一些 Linux 发行版中,通常使用:
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
After modifying your configuration don't forget to restart the services systemctl restart php-fpm
. To check that the socket has been created you could do:
修改配置后不要忘记重新启动服务systemctl restart php-fpm
。要检查套接字是否已创建,您可以执行以下操作:
$ file /var/run/php/php7.0-fpm.sock
If socket exists if should print out something like this:
如果套接字存在,则应打印出如下内容:
/var/run/php/php7.0-fpm.sock: socket
回答by Breign
you can see it by running
你可以通过运行看到它
$ ss --unix |grep 'php'
回答by rahul singh Chauhan
It is likely that an older libpcre3 is installed and satisfies the dependency in the php7.0 package, but only the newer library package provides pcre_jit_stack_free.
很可能安装了较旧的 libpcre3 并满足 php7.0 包中的依赖关系,但只有较新的库包提供 pcre_jit_stack_free。
If this is the case, do an apt-get install libpcre3, and you're good to go.
如果是这种情况,请执行 apt-get install libpcre3,然后就可以了。
Ref.: https://github.com/oerdnj/deb.sury.org/issues/372
参考:https: //github.com/oerdnj/deb.sury.org/issues/372
I hope this helps you.
我希望这可以帮助你。
回答by psirus0588
Use this:
用这个:
cat /etc/php/7.0/fpm/pool.d/www.conf | grep 'listen ='
Output example:listen = /run/php/php7.2-fpm.sock
输出示例:listen = /run/php/php7.2-fpm.sock
Or for universal php vesions:
或者对于通用的 php 版本:
cat /etc/php/$(php -r "echo PHP_VERSION;" | grep --only-matching --perl-regexp "7.\d+")/fpm/pool.d/www.conf | grep 'listen ='