標籤: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