本文介紹了PHP - 如何安裝 PDO 驅動程序?(視窗)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我正在 Windows 8.1 上設置 PHP 和 MySQL (Maria DB).我編輯了 php.ini 文件并取消了以下幾行的注釋:
I am setting up PHP and MySQL (Maria DB) on Windows 8.1. I edited php.ini file and uncommented the following lines:
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo_mysql.dll
但不幸的是,我無法連接到數據庫,因為 phpinfo 輸出中沒有顯示 pdo 驅動程序.所以,當我嘗試建立數據庫連接時,拋出異常:
But unfortunately I cannot connect to database because there are no pdo drivers shown in phpinfo output. So, when I try to establish database connection, an exception is thrown:
Fatal error: Uncaught exception 'PDOException' with message 'could not find driver'
如何解決這個問題?
推薦答案
最后我設法解決了這個問題.我更正了 php.ini 文件中的 extension_dir 條目(需要絕對文件路徑),數據庫連接開始工作.
Finaly I managed to settle this stuff. I corrected extension_dir entry (absolute file path was needed) in php.ini file and database connection began to work.
這篇關于PHP - 如何安裝 PDO 驅動程序?(視窗)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!