This is an old revision of the document!
Add mysqlnd.localhost_override option
- Version: 0.1
- Date: 2013-02-12
- Author: Asbjørn Sannes <asbjorn.sannes.at.interhost.no>
- Status: In Draft
- First Published at: https://wiki.php.net/rfc/mysqlnd_localhost_override
When “localhost” is set as the mysql host, the connection is set to connect to the specified socket. If no socket is set the hardcoded default of /tmp/mysql.sock is used.
I have noted the following:
- many populare php applications put in localhost as the default, making it work out of the box for most installations.
- many distributions patches the default of /tmp/mysql.sock today to match where their default MySQL installation puts their unix socket.
- when splitting a webserver and mysql installation all the applications needs to be reconfigured to point at the external mysql server.
Proposal and Patch
I propose we introduce a new option called mysqlnd.localhost_override which enables a system administrator or php distributor to configure how localhost should be overriden.
It keeps backward compatability by falling back to current behaviour if mysqlnd.localhost_override is not set.
If the old behaviour were to be deprecated or phased out, a default value of unix:///tmp/mysql.sock may be appropriate. It would also leave the behaviour of “localhost” easier to follow.
If this extension of mysqlnd were to be accepted and merged, the documentation must be updated to include the new option and its syntax.
Example of usage:
mysqlnd.localhost_override = unix:///var/run/mysql/mysqld.sock mysqlnd.localhost_override = tcp://otherhost:3306
0.1 Initial draft