I am trying to connect to a remote myql database server which is running centos 4.4 with mysql 5.0.27.
The website server is using apache (httpd 2.2.3), PHP 5.1.6 and Mysql Client API version 5.0.22.
Using a basic php script that does notthing but use mysql_connect to connect to the database server I get the following behaviour.
When run by accessing the php file through apache I get the error
"2003 : Can't connect to MySQL server on 'xx.xx.xx.xx' (13)"
where 2003 is the mysql_errno and the rest is mysql_error (I replaced my actal db server ip with xx for obvious reasons).
But If I run the same file from the command line "php connect.php" it connects to the db server no problem. As well if I run "mysql -h xx.xx.xx.xx -u ASDF -p" I can connect no problem as well. And just to be sure I have turned off iptables while trying to debug this problem.
I have setup a mysql db on the webserver and had no problem connecting to localhost... It is only a problem when trying to access a remote db server.
I have run the same php file from other servers and they have no problems connecting when run through apache (they have different centos versions but all 4 and above).
I have looked everywhere I can think to try and find some firewall like setting that is only active when running php/mysql through httpd but have come up empty. I hope there is just some simple httpd.conf setting that I have overlooked but at this point I am desperate to find it...
Thanks for reading.