Friday, June 1, 2012

PHP Unable to Connect to MySQL

When you get an error something like "SQLSTATE[HY000] [2003] Can't connect to MySQL server" with a subsequent error code "13" later on in the error message....

This is due to selinux preventing the web server from making external network connections.

To fix this, issue the following command as root:
setsebool -P httpd_can_network_connect=1

No comments:

Post a Comment