Am 12.02.2013 13:11, schrieb Johannes Schlüter:
On Tue, 2013-02-12 at 12:51 +0100, Asbjørn Sannes wrote:
https://wiki.php.net/rfc/mysqlnd_localhost_override

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 overridden.

The "localhost" behavior is already confusing enough. If you want to
have such behavor for your system I suggest a plugin like described in
http://schlueters.de/blog/archives/146-mysqlnd-plugins-for-PHP-in-practice.html 
but not as a core feature.

Abusing PECL/mysqlnd_ms is also possible...

nixnutz@linux-0v4u:~/php-src/pecl/mysqlnd_ms/trunk/examples> cat s1.json
{
  "localhost": {
    "master": {
      "alias_name": {
        "host": "192.168.2.28",
        "port": 3306,
        "db": "test"
      }
    },
    "slave" : {}
  }
}
nixnutz@linux-0v4u:~/php-src/pecl/mysqlnd_ms/trunk/examples> php -d mysqlnd_ms.enable=1 -d mysqlnd_ms.disable_rw_split -d mysqlnd_ms.force_config_usage=1 -d mysqlnd_ms.config_file=s1.json -r '$mysqli = new mysqli("localhost", "root"); var_dump($mysqli->query("SELECT 1")->fetch_assoc()); var_dump($mysqli->query("DROP TABLE IF EXISTS test")); var_dump($mysqli->host_info);'
array(1) {
  [1]=>
  string(1) "1"
}
bool(true)
string(23) "192.168.2.28 via TCP/IP"

Ulf

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to