This afternoon to configure the project when the PDO can not connect to the database, tried a lot of ways to find or not even, in the fast despair, finally found a and I met the same problem, the solution is as follows:
[Email protected] ~]# 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
[Email protected] ~]# setsebool-p httpd_can_network_connect_db=1
Found finally can connect to the database, and then asked the next operation, only to know that may be selinux block access to the external database, can be shut down, as follows:
/usr/sbin/setenforce 0 Close SELINUX immediately
/usr/sbin/setenforce 1 Enable SELINUX now
Add to system default boot inside
echo "/usr/sbin/setenforce 0" >>/etc/rc.local
A configuration problem under CentOS