2015-12-21 6 views
10

पहले से ही माइक्रोसॉफ्ट पर sqlsrv डाउनलोड किया एसक्यूएल सर्वर के साथ संवाद करने एसक्यूएल सर्वर के लिए Microsoft ODBC ड्राइवर 11 की आवश्यकता है ...इस विस्तार

enter image description here

और मेरे phpinfo() पर

enter image description here

enter image description here

php.ini परपर सक्षमऔर C:\wamp\bin\php\php5.5.12 enter image description here

और अभी भी इस तरह त्रुटि मिली।

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 

और मेरे कोड

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

"चालक 11"। क्या आपने जांच की है कि आपने वास्तव में कौन सा संस्करण स्थापित किया है? बस एक sqlserver ड्राइवर होने का मतलब कुछ भी नहीं है। –

+0

@MarcB आपका क्या मतलब है? इसे कहाँ जांचें? –

उत्तर

22

pdo_sqlsrv extenssion आप भी ODBC 11 ड्राइवर आपकी मशीन पर स्थापित करने की आवश्यकता के अलावा है।

आप इसे यहाँ प्राप्त कर सकते हैं: https://www.microsoft.com/en-us/download/details.aspx?id=36434

+0

मुझे हेहेहे बचाने के लिए धन्यवाद – GuiPab

संबंधित मुद्दे