Mysqlnd replication and load balancing plugin (
mysqlnd_ms
)
2603
The PHP configuration directive
mysqlnd_ms.config_file
is used to set the plugins configuration
file. Please note, that the PHP configuration directive may not be evaluated for every web request.
Therefore, changing the plugins configuration file name or location may require a PHP restart.
However, no restart is required to read changes if an already existing plugin configuration file is
updated.
Using and parsing JSON is efficient, and using JSON makes it easier to express hierarchical data
structures than the standard
php.ini
format.
Example 20.264. Converting a PHP array (hash) into JSON format
Or alternatively, a developer may be more familiar with the PHP array syntax, and prefer it. This
example demonstrates how a developer might convert a PHP array to JSON.
<?php
$config = array(
"myapp" => array(
"master" => array(
"master_0" => array(
"host" => "localhost",
"socket" => "/tmp/mysql.sock",
),
),
"slave" => array(),
),
);
file_put_contents("mysqlnd_ms.ini", json_encode($config, JSON_PRETTY_PRINT));
printf("mysqlnd_ms.ini file created...\n");
printf("Dumping file contents...\n");
printf("%s\n", str_repeat("-", 80));
echo file_get_contents("mysqlnd_ms.ini");
printf("\n%s\n", str_repeat("-", 80));
?>
The above example will output:
mysqlnd_ms.ini file created...
Dumping file contents...
--------------------------------------------------------------------------------
{
"myapp": {
"master": {
"master_0": {
"host": "localhost",
"socket": "\/tmp\/mysql.sock"
}
},
"slave": [
]
}
}
--------------------------------------------------------------------------------
A plugin configuration file consists of one or more sections. Sections are represented by the top-level
object properties of the object encoded in the JSON file. Sections could also be called configuration
names.
Applications reference sections by their name. Applications use section names as the host (server)
parameter to the various connect methods of the
mysqli
,
mysql
and
PDO_MYSQL
extensions. Upon
connect, the
mysqlnd
plugin compares the hostname with all of the section names from the plugin
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...