1. Go to this page and download the library: Download corn/mypdoms library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Corn\MyPDOMS\MyPDOMS;
$db = new MyPDOMS('mysql:host=my_site_1;dbname=my_database;charset=utf8mb4', null, null, [MyPDOMS::ATTR_TIMEOUT => 5]);
use Corn\MyPDOMS\MyPDOMS;
$db = new MyPDOMS($dsn);
$db->query("/*" . MyPDOMS::HINT_MASTER . "*/SELECT 1"); // will be sent to the master even though it's a SELECT
use Corn\MyPDOMS\MyPDOMS;
if (!defined('MYSQLND_MS_MASTER_SWITCH')) {
define('MYSQLND_MS_MASTER_SWITCH', MyPDOMS::HINT_MASTER);
define('MYSQLND_MS_SLAVE_SWITCH', MyPDOMS::HINT_SLAVE);
define('MYSQLND_MS_LAST_USED_SWITCH', MyPDOMS::HINT_LAST_USED);
}