The PHP code is simple:
The
code is as follows:
$server = "127.0.0.1";
println ("Begin");
$link = mysql_connect ($server, "MySQL", "MySQL");
if (! $link) {
die (' Could not connect: '. Mysql_error (). Mysql_errno ());
}
Linux native use of PHP mysql.php can view the results of the run, but in my Windows browser error:
The
code is as follows:
could not Connect:can ' t connect to MySQL server on ' 127.0.0.1 ' (13) 2003
Reason:
The
code is as follows:
#getsebool-A | grep httpd
[Neo@neo phpmytest]$ getsebool-a | grep httpd
Found Httpd_can_network_connect--> off
Solution:
The
code is as follows:
#setsebool httpd_can_network_connect 1
It turned out to be SELINUX, so I generally shut down SELINUX and iptables ip6tables directly.
The
code is as follows:
# Close SELinux
chkconfig--level 12345 iptables off
Chkconfig--level 12345 ip6tables off
Service Iptables Stop
Service Ip6tables Stop
To view the SELinux status:
1,/usr/sbin/sestatus-v # #如果SELinux Status parameter is enabled that is open
SELinux status:enabled
2, Getenforce # #也可以用这个命令检查
Close SELinux:
1, temporarily shut down (do not restart the machine):
Setenforce 0 # #设置SELinux become permissive mode
# #setenforce 1 set SELinux become enforcing mode
2, modify the configuration file needs to reboot the machine:
modifying/etc/selinux/config files
Change Selinux=enforcing to Selinux=disabled