简体   繁体   English

nginx上的PHP-FPM无法连接到外部MySQL

[英]PHP-FPM on nginx will not connect to an external MySQL

I have a centos server running nginx + php-fpm that will not connect to an external database for the purpose of a wordpress install. 我有一台运行nginx + php-fpm的centos服务器,该服务器不会出于wordpress安装的目的而连接到外部数据库。

I can ssh into the webs erver and run mysql to connect to the external mysql database fine but when trying to us php to connect to the database it fails. 我可以通过ssh进入网络并运行mysql以连接到外部mysql数据库,但是当尝试使用php连接数据库时,它会失败。

Where should I look to resolve this issue? 我应该在哪里解决这个问题?

It is possible for the problem to be related to selinux (as it was in my case today). 问题可能与selinux有关(就像我今天的情况一样)。

Try to run 尝试跑步

setsebool httpd_can_network_connect_db on

Or if that doesn't work: 或者,如果这不起作用:

setenforce 0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM