php - Connection falied: could not find driver -


i'm on windows 10 , i'm using wamp. trying create login form prepared pdo statements. below code connect.php script issuing error: "connection failed: not find driver".

<?php  $server = 'localhost'; $username = 'root'; $password = ''; $db = 'login';  try{     $conn = new pdo("mysqli:host=$server;dbname=$db", $username, $password);     $conn->setattribute(pdo::attr_errmode, pdo::errmode_exception);     echo "connected successfully"; }catch(pdoexception $e){     echo "connection falied: " . $e->getmessage(); }  ?> 

this list php.ini file shows , dlls associated pdo

extension=php_openssl.dll extension=php_pdo_firebird.dll extension=php_pdo_mysql.dll extension=php_pdo_oci.dll extension=php_pdo_odbc.dll extension=php_pdo_pgsql.dll extension=php_pdo_sqlite.dll extension=php_pdo_mysql.dll extension=php_pdo.dll extension=php_pdo_pgsql.dll extension=php_pdo_sqlite.dll extension=php_pgsql.dll ;extension=php_shmop.dll 

wamp says "no dll file" for: -php_mysqli -php_pdo

i have "php_pdo" dll file in wamp/bin/php5.6.25/ , in wamp/bin/php5.6.25/ext/ in case. can't find download php_mysqli don't think need pdo, though nice have if has download link.

so question is, did install dll file wrong directory, or what? i'm not sure do, installed wamp , can't use pdo. should use client(i'm not sure called).

i think have typo, try mysql instead of msqli:

$conn = new pdo("mysql:host=$server;dbname=$db", $username, $password); 

also comments:

  1. try put in php.ini : extension_dir = "c:\php5\ext" , point extension
  2. move php_pdo.dll before other pdo extensions, , restart wamp

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -