I have weird situation in newly installed server, and it seems that Google can\'t help me this time. I can\'t connect to (remote) mysql from my php-code. When I try to conn
setsebool -P httpd_can_network_connect=1
will also be a helpful CLI command to many people visiting this question, as to allow mysql_connet() connections from within HTTP (Apache) requests to a remote MySQL database server, ensure to enable Network Connections from httpd in SElinux usually located in /etc/selinux/config (disabled by default to prevent hackers from attacking other machines using your httpd).