文档章节

php-fpm error unable to bind listening socket for

china008
 china008
发布于 2015/08/26 15:44
字数 356
阅读 140
收藏 0

0 down vote

SELinux can be configured to stop programs from opening ports, even ports above 1024. This can be a useful protection against malware.


If SELinux is enabled (which you can check by running getenforce - if the respons is Enforced, that means that SELinux is active), there are two ways of fixing the problem.


First, the easy way. This one is to simply disable SELinux. The downside is that your server is now far more vulnerable to compromise/hacking/attacks. If you do choose to make your server less secure, you can run the command setenforce 0. You will also need to change the configuration to stop it from being reactivated after restart; this is done by editing the file /etc/selinux/config and changing the line


SELINUX=enforcing

to


SELINUX=disabled

Second, the secure way . This is to change your selinux configuration to allow this port to be opened. Since SELinux is a very complicated thing - as it must be, to do what it does - it takes a bit of work. There is one shortcut, though, which is to let SELinux itself figure out what new permissions it needs to allow.


In order to do this, you start by setting SELinux to permissive instead of disabled. This means that SELinux won't be enforcing its rules, but it will log the information about everything that it would have stopped if it had been enforcing them. Once you've had your application running, you can pass the contents of the log to audit2allow which will help you create the rules you need:


grep php-fpm /var/log/audit/audit.log | audit2allow -m phpfpm > phpfpmlocal.tmp

You should look in the file phpfpmlocal.tmp to verify that the permissions look OK. Once you've done so, and made any edits that seem reasonable to you, re-run audit2allow again to build the module, and semodule to load it


grep php-fpm /var/log/audit/audit.log | audit2allow -M phpfpmlocal

semodule -i phpfmlocal.pp 

Once the new module is loaded, you can turn enforcement back on.


本文转载自:http://unix.stackexchange.com/questions/180460/php-fpm-error-unable-to-bind-listening-socket-for-...

共有 人打赏支持
china008
粉丝 5
博文 286
码字总数 30406
作品 0
海淀
私信 提问
ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use

刚安装完PHP,启动时报错: # /etc/init.d/php-fpm start Starting php-fpm [15-Apr-2017 13:21:13] ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address alrea......

sentu
2017/04/16
0
0
关于FPM的安装问题

用 /usr/local/php/sbin/php-fpm启动FPM,总是出现unable to bind listening socket for address '127.0.0.1:9000': Address already in use (98), FPM initialization failed。。。这个报错......

Teomc.Xbc
2012/09/20
1K
2
pthreads(一)php7只支持在cli模式下使用pthreads扩展

1 ERROR! 用php7了,编译之后安装好扩展,运行php-fpm时报错,在公司没有解决,回家在mac上复现: [24-Mar-2016 23:06:50] NOTICE: PHP message: PHP Fatal error: The fpm-fcgi SAPI is no...

燕玉苗
2016/10/17
3
0
关于apache2在linux启动命令的疑问

coat@Blue :~$ apache2ctl restart /usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted) httpd not running, trying to start (13)Permission denied: make_s......

coat
2013/12/08
1K
8
FastCGI 协议分析与C语言实现实例

考虑让我的 web server 增加对 PHP 的支持,这就要用到 php 解析器来将客户端请求的 php 文件解析为静态资源,再由我的 web server 将其返回到客户端,php-fpm 就可以来帮我们完成这个工作。...

Tanswer_
2017/12/23
0
0

没有更多内容

加载失败,请刷新页面

加载更多

乱入Linux界的我是如何学习的

欢迎来到建哥学Linux,咳!咳!咳!开个玩笑哈,我是一个IT男,IT界的入门选手,正在学习Linux。 在之前,一直想进军IT界,学习IT技术,但是苦于没有人指导,也不知道学什么,最开始我自己在...

linuxprobe16
28分钟前
0
0
OSChina 周日乱弹 —— 没时间 没头发 但有钱

Osc乱弹歌单(2019)请戳(这里) 【今日歌曲】 @开源中国总经办主任 :分享齐一的单曲《这个年纪》 《这个年纪》- 齐一 手机党少年们想听歌,请使劲儿戳(这里) @肿肿卷 :我真的可以睡一天...

小小编辑
今天
41
4
Django进阶 1.1 ORM基础—ORM 1.2.1 增删改查之查询 1.2.2 删改增 (1) 1.2.3 删改增 (2)

ORM基础 ORM是Django操作数据库的API,Django的作者将sql语句封装在里面供我们使用。 我们前面还提到过Django提供一个模拟数据库的工具,sqlite,供我们学习测试使用。 如果我们想使用mysql...

隐匿的蚂蚁
今天
3
0
Windows 上安装 Scala

在安装 Scala 之前需要先安装 Java 环境,具体安装的详细方法就不在这里描述了。 您可以自行搜索我们网站中的内容获得其他网站的帮助来获得如何安装 Java 环境的方法。 接下来,我们可以从 ...

honeymose
今天
3
0
数据库篇多表操作

第1章 多表操作 实际开发中,一个项目通常需要很多张表才能完成。例如:一个商城项目就需要分类表(category)、商品表(products)、订单表(orders)等多张表。且这些表的数据之间存在一定的关系...

stars永恒
今天
4
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部