Thursday, October 11, 2007

SELinux, Apache, phpMyAdmin, and a Remote MySQL Server

Today I ran into a little problem with phpMyAdmin talking to a remote MySQL server on a CentOS 5 machine. When I would try to connect to the server it would say that the host could not be reached. However, if I used the mysql cli I was able to connect. It turns out that the SELinux policy was prohibiting me from accomplishing this.

To fix this problem you need to modify the policy with the following command.
setsebool -P httpd_can_network_connect=1

This change is instant and persistent, so it will survive a reboot.