Learning PHP Programming Encounters
Uncaught exception ' pdoexception ' with a message ' could not find driver '
Or
Undefined class constant ' Mysql_attr_init_command '
The whole two questions, the Internet to find a lot of information, a lot of this solution
Configure the php.ini file to add Extension=php_pdo_mysql.dll so that the Pdomysql extension library is turned on
But I did not solve the problem, the problem is still the same, and later found the problem in StackOverflow
Specific links http://stackoverflow.com/questions/7086859/pdo-drivers-no-value-in-windows
The problem is.
Extension_dir = "ext"
You can change it to an absolute path.
; 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"
Reason
In PHP.ini and php -m
is 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
absolute path. I ' m guessing it got confused when running through Apache and made it relative to something else.
I fixed it by changing the absolute path of the extension_dir. I guess it confuses the runtime through Apache and relative to something else.
Reprint: http://blog.csdn.net/bao0682/article/details/46827111
PDO drivers no value in Windows