When localhost is encoundtered in mysqlnd, it is overriden by /tmp/mysql.sock or socket_option.
Many distributions have their own custom patches to have a correct default for their distribution. This pull request adds mysqlnd.localhost_override ini option to configure it from their configuration options.
The implementation is straightforward and it is backward compatible, if you do not set it the behaviour is as it used to be.
A side effect is that you can use remote hosts as the override (tcp://ip:port). Many applications use localhost as the default host, and it would be nice if it was easier to configure it to use alternative hosts.
Another case that would also benefit is where a host goes from having mysql on the localhost to a seperate host.
Make localhost override configurable by introducing mysqlnd.localhost…
Not sure why it is necessary - if you want different socket path, there are socket configurations, why congifure it via "localhost override"? Even more strange would be to override localhost with remote connection having nothing to do with localhost.
Comment on behalf of krakjoe at php.net:
The default socket location is configurable by normal means.
This is not necessary.