SELinux:[CentOS 5.4] MySQL-PHP Remote Database script error fix.
   If you haven't disabled SELinux, by default it restricts httpd/Apache to connect to a remote database. Which explains why we can connect through terminal commands but cannot when using PHP scripts.

   To fix this, type in the following to enable SELinux to allow Apache connection to remote database:

    setsebool -P httpd_can_network_connect=1