centos7 centos中apache运行php需要连接mysql一直连不上,telnet访问mysql出错Connection closed by foreign host

执行命令:

getsebool -a|grep httpd 

发现 
httpd_can_network_connect off 


解决: 

setsebool httpd_can_network_connect 1 && setsebool httpd_can_network_connect_cobbler 1 && setsebool httpd_can_network_connect_db 1 && setsebool httpd_can_network_relay 1



需要重新启动httpd

systemctl restart httpd.service

 

 

posted @ 2018-11-01 19:47  007少侠  阅读(1530)  评论(0编辑  收藏  举报
友情链接:便宜vps(CN2GIA线路)
站长统计: