2015-12-21 12 views
10

già scaricato lo SQLSRV su microsoft ...Questa estensione richiede il driver ODBC di Microsoft 11 per SQL Server per comunicare con SQL Server

enter image description here

e sul mio phpinfo()

enter image description here

enter image description here

abilitato su php.ini su entrambi C:\wamp\bin\apache\apache2.4.9\bin e C:\wamp\bin\php\php5.5.12 enter image description here

e ancora errore in questo modo.

Failed to get DB handle: SQLSTATE[IMSSP]: This extension requires the Microsoft ODBC Driver 11 for SQL Server to communicate with SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712 

e il mio codice è

try { 
    $dbh = new PDO ("sqlsrv:Server=$host;Database=$db","$user","$pass"); 
    } catch (PDOException $e) { 
    echo "Failed to get DB handle: " . $e->getMessage() . "\n"; 
    exit; 
    } 
    $stmt = $dbh->prepare("select top 5 from teams"); 
    $stmt->execute(); 
    while ($row = $stmt->fetch()) { 
    print_r($row); 
    } 
    unset($dbh); unset($stmt); 
+0

"conducente 11". hai controllato quale versione hai effettivamente installato? solo avere un driver sqlserver non significa nulla. –

+0

@MarcB cosa intendi? dove controllarlo? –

risposta

Problemi correlati