Mysql socket
| From: | PAGES Vincent | Date: | Wed, 08 Jun 2005 15:06:44 +0000 |
| Subject: | Mysql socket | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-16551@lists.php.net to get a copy of this message | ||
Hi,
I hope i'm writing in the good mailing list...
Since one year, i'm working on loadbalancing solution for webservers (usually Apache 2). Behind a cluster of http servers, we can find a mysql cluster.
Generally ppl are using the mysql_connect with the hostname = "localhost". When i suggest a loadbalancing solution, the mysql database is hosted on a different server. So webpages of all virtual hosts need to be updated to connect on the new hostname; which can be very annoying.
I've patched PHP, and added 2 variables in PHP.ini which are :
mysql.unix_socket = disabled
mysql.force_hostname =
The first one disabled the connection on mysql unix socket and transform "localhost" in "127.0.0.1". This allows to redirect mysql traffic with iptables.
The second force mysql_connect to one database whatever the hostname specified in the mysql_connect function.
I think it can be someting helpful for System Administrators. Tell me ur feeling about this.
--
PAGES Vincent
System Administrator
France