====== Add mysqlnd.localhost_override option ====== * Version: 0.2 * Date: 2013-02-12 * Author: Asbjørn Sannes * Status: Widthdrawn * First Published at: https://wiki.php.net/rfc/mysqlnd_localhost_override ===== Withdrawn ===== There are methods to work around this: * write a mysqlnd plugin (Johannes Schlüter) * PDO already support DSN-alias, php.net/pdo.configuration#ini.pdo.dsn (Sebastian Krebs) ===== Introduction ===== 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. https://github.com/php/php-src/pull/275 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. ===== Documentation ===== 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 ===== Changelog ===== 0.1 Initial draft 0.2 Withdrawn