php - PHP7 driver not found (mysql) -
here connection code (php7):
try { $conn = new pdo('mysql :host='.$host.';dbname='.$database, $user, $password); } catch (exception $e) { die('erreur : ' . $e->getmessage()); }
and receive following error 'could not find driver" :
my phpinfo():
pdo pdo support enabled pdo drivers mysql, sqlite pdo_mysql pdo driver mysql enabled client api version mysqlnd 5.0.12-dev - 20150407 - $id: b5c5906d452ec590732a93b051f3827e02749b83 $ directive local value master value pdo_mysql.default_socket /var/run/mysqld/mysqld.sock /var/run/mysqld/mysqld.sock
any idea?
try instead connection string:
$conn = new pdo("mysql:host=$host;dbname=$database", $user, $password);
poorly placed spaces cause problems.
Comments
Post a Comment