php代码很简单: $server="127.0.0.1"; println("Begin"); $link = mysql_connect($server,"mysql","mysql"); if (!$link) { die('Could not connect: ' . mysql_error().mysql_errno()); } linux本机下使用php mysql.php 可以查看运行结果,但是 在我的wind
php代码很简单:
$server="127.0.0.1";
println("Begin");
$link = mysql_connect($server,"mysql","mysql");
if (!$link) {
die('Could not connect: ' . mysql_error().mysql_errno());
}
linux本机下使用php mysql.php 可以查看运行结果,但是 在我的windows浏览器下报错:
Could not connect: Can't connect to MySQL server on '127.0.0.1' (13) 2003
原因:
#getsebool -a | grep httpd
[neo@neo phpMyTest]$ getsebool -a | grep httpd
#setsebool httpd_can_network_connect 1
原来是 SELINUX,所以我一般直接关闭SELINUX和 iptables ip6tables
# 关闭SELINUX
chkconfig --level 12345 iptables off
chkconfig --level 12345 ip6tables off
service iptables stop
service ip6tables stop
立即学习“PHP免费学习笔记(深入)”;
查看SELinux状态:
1、/usr/sbin/sestatus -v ##如果SELinux status参数为enabled即为开启状态
用 php + mysql 驱动的在线商城系统,我们的目标为中国的中小企业及个人提供最简洁,最安全,最高效的在线商城解决方案,使用了自建的会员积分折扣功能,不同的会员组有不同的折扣,让您的商店吸引更多的后续客户。 系统自动加分处理功能,自动处理会员等级,免去人工处理的工作量,让您的商店运作起来更方便省事 采用了自建的直接模板技术,免去了模板解析时间,提高了代码利用效率 独立开发的购物车系统,使用最
0
SELinux status: enabled
2、getenforce ##也可以用这个命令检查
关闭SELinux:
1、临时关闭(不用重启机器):
setenforce 0 ##设置SELinux 成为permissive模式
##setenforce 1 设置SELinux 成为enforcing模式
2、修改配置文件需要重启机器:
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号