diff options
author | Chris Cornutt <enygma@phpdeveloper.org> | 2016-07-14 09:34:07 -0500 |
---|---|---|
committer | Chris Cornutt <enygma@phpdeveloper.org> | 2016-07-14 09:34:07 -0500 |
commit | 5f940dc865ae6a3f3881a043d48a363e0ecde322 (patch) | |
tree | 1910fec7b12185722f836b0a2b4fc77b2b74d67c | |
parent | 65731c8ffe4f1070f4040927d6158c4afc9b9127 (diff) | |
download | gatekeeper-5f940dc865ae6a3f3881a043d48a363e0ecde322.zip gatekeeper-5f940dc865ae6a3f3881a043d48a363e0ecde322.tar.gz gatekeeper-5f940dc865ae6a3f3881a043d48a363e0ecde322.tar.bz2 |
Adding check for mysql vs mysqli extension (mysql removed in PHP 7)
-rw-r--r-- | src/Psecio/Gatekeeper/DataSource/Mysql.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Psecio/Gatekeeper/DataSource/Mysql.php b/src/Psecio/Gatekeeper/DataSource/Mysql.php index 07ec6d8..b27f387 100644 --- a/src/Psecio/Gatekeeper/DataSource/Mysql.php +++ b/src/Psecio/Gatekeeper/DataSource/Mysql.php @@ -31,8 +31,12 @@ class Mysql extends \Psecio\Gatekeeper\DataSource */ public function buildPdo(array $config) { + $dbType = 'mysql'; + if (extension_loaded('mysqli') === true) { + $dbType = 'mysqli'; + } return new \PDO( - 'mysql:dbname='.$config['name'].';host='.$config['host'].';charset=utf8', + $dbType.':dbname='.$config['name'].';host='.$config['host'].';charset=utf8', $config['username'], $config['password'] ); } |