Oracle 5.0 Reference Manual page 2623

Table of Contents

Advertisement

Mysqlnd replication and load balancing plugin (mysqlnd_ms)
The PHP configuration directive
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
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,
connect, the
mysqlnd
plugin compares the hostname with all of the section names from the plugin
mysqlnd_ms.config_file
format.
php.ini
2603
is used to set the plugins configuration
mysql
and
PDO_MYSQL
extensions. Upon

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents