PDO drivers no value in Windows

來源:互聯網
上載者:User

標籤:drivers   學習   info   dir   was   ada   mis   extension   highlight   

學習php編程遇到 

Uncaught exception ‘PDOException‘ with message ‘could not find driver‘  

或者 

Undefined class constant ‘MYSQL_ATTR_INIT_COMMAND‘

整兩個問題,網上找了很多資料,很多是這樣解決的

配置php.ini檔案添加extension=php_pdo_mysql.dll,這樣就開啟pdomysql擴充庫 

但是我沒有解決問題,問題還是老樣子,後來在stackoverflow 找到了問題所在

具體連結http://stackoverflow.com/questions/7086859/pdo-drivers-no-value-in-windows

問題出在了

extension_dir = "ext"
改成絕對路徑就可以了
; Directory in which the loadable extensions (modules) reside.; http://php.net/extension-dir; extension_dir = "./"; On windows:extension_dir = "D:/php-5.4.11-Win32-VC9-x86/ext"
原因

in php.ini and php -m was starting fine and reporting that it loaded pdo_mysql, but when I ran phpinfo.php through apache, the driver was missing.

I fixed it by changing the extension_dir to an absolute path. I‘m guessing it got confused when running through Apache and made it relative to something else.  

我固定它通過改變extension_dir絕對路徑。我猜它混淆了運行時通過Apache和相對於別的東西。

轉載:http://blog.csdn.net/bao0682/article/details/46827111

PDO drivers no value in Windows

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.