Home >Backend Development >PHP Tutorial >Solve the problem that PHP cannot access remote mysql_PHP tutorial
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