Home  >  Article  >  Backend Development  >  Solve the problem that PHP cannot access remote mysql_PHP tutorial

Solve the problem that PHP cannot access remote mysql_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:17:39749browse

Explain that 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 a search 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.

Finally, I thought about the problem of SELINUX. I compared the two machines AB and found that the settings are indeed different! It is probably its problem, there is something wrong!

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 don’t want to restart, enter

on the command line.

setenforce 0

Enter, OK

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/371973.htmlTechArticle explains that 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 A machine...
Statement:
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