Home > Backend Development > PHP Tutorial > Analysis and solution to the problem that PHP cannot access remote mysql_PHP tutorial

Analysis and solution to the problem that PHP cannot access remote mysql_PHP tutorial

WBOY
Release: 2016-07-21 15:10:13
Original
770 people have browsed it

First of all, the remote server can be accessed remotely.

The problem I encountered is this: There are three servers A, B, and C. C is the server. B can successfully connect to the mysql of C machine using PHP, but machine A cannot connect!
It can be said that there is definitely no problem with the code, and there is no problem with the mysql settings on the server, because machine B is fine.
There must be something wrong with the settings of machine A!

After searching on the Internet, there are various reports about mysql authorization issues, modifications to php.ini, and modifications to the firewall. In fact, these problems are not caused.
Similar to the issues discussed on this page, but no one gave the results, link: http://bbs.csdn.net/topics/90284141
Finally, I thought of the SELINUX issue and compared the two AB machines. The machine, indeed the settings are different! I guess that's the problem with it, it's fun!

The following settings have been made:

Under root, use vim to open the file /etc/selinux/config
Modify the value of SELINUX:
#SELINUX=enforcing
SELINUX =disabled
Save and exit.
Restart will take effect. If you do not want to restart, enter
setenforce 0 on the command line
Press Enter, OK
Reference for modification here: http://www.xiaojb.com/archives/tips/disabled-selinux .shtml

Finally, the connection is successful, oh yeah! ! !

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327132.htmlTechArticleFirst of all, the remote server can be accessed remotely. The problem I encountered is this: There are three servers A, B, and C. C is the server. B can successfully connect to the mysql of the C machine using PHP, but...
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