码迷,mamicode.com
首页 > 其他好文 > 详细

一个centos下的配置问题

时间:2015-07-31 19:52:49      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:

  今天下午配置项目的时候发现 框架里的pdo无法连接数据库,试了好多方法发现还是连不了,在快绝望的时候,终于找到了一个和我碰见同样问题的人,解决方法如下:

  

[root@mio-253 ~]# getsebool -a | grep httpd

allow_httpd_anon_write --> off

allow_httpd_mod_auth_ntlm_winbind --> off

allow_httpd_mod_auth_pam --> off

allow_httpd_sys_script_anon_write --> off

httpd_builtin_scripting --> on

httpd_can_check_spam --> off

httpd_can_network_connect --> off

httpd_can_network_connect_cobbler --> off

httpd_can_network_connect_db --> off

httpd_can_network_memcache --> off

httpd_can_network_relay --> off

httpd_can_sendmail --> off

httpd_dbus_avahi --> on

httpd_enable_cgi --> on

httpd_enable_ftp_server --> off

httpd_enable_homedirs --> off

httpd_execmem --> off

httpd_manage_ipa --> off

httpd_read_user_content --> off

httpd_run_stickshift --> off

httpd_setrlimit --> off

httpd_ssi_exec --> off

httpd_tmp_exec --> off

httpd_tty_comm --> on

httpd_unified --> on

httpd_use_cifs --> off

httpd_use_gpg --> off

httpd_use_nfs --> off

httpd_use_openstack --> off

httpd_verify_dns --> off

[root@mio-253 ~]# setsebool -P httpd_can_network_connect_db=1

发现终于可以连接上数据库了,然后问了下运维,才知道可能是selinux阻止访问外部数据库,可以关闭掉,方法如下:

/usr/sbin/setenforce 0 立刻关闭 SELINUX
/usr/sbin/setenforce 1 立刻启用 SELINUX

加到系统默认启动里面
echo "/usr/sbin/setenforce 0" >> /etc/rc.local

 

一个centos下的配置问题

标签:

原文地址:http://www.cnblogs.com/tudou1223/p/4692855.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!