Yii "Cdbconnection failed to open the DB connection:could not find driver" workaround

Source: Internet
Author: User
Tags phpinfo yii

Preface: When using the YII framework to do the project, sometimes encounter "Cdbconnection failed to open the DB connection:could not find driver" problem, this problem is usually because there is no load pdo_ Mysql.dll extension. Here's how to find the problem and fix it:

First, see if there is a pdo_mysql module in Phpinfo or enter php-m in CMD to see if the Pdo_mysql module is loaded.

Second, if the Pdo_mysql module is not found in the first step, then it is php.ini in the Extension=php_pdo_mysql.dll to remove the comments, while ensuring that the Ext folder exists php_pdo_mysql.dll the extension file. Then restart Apache and see if there is a pdo_mysql module in Phpinfo.

Note: If you have multiple PHP environments installed, be sure to determine which php.ini you are loading before modifying php.ini, either by phpinfo or by typing php--ini in cmd to see which php.ini is loaded. I was installed two PHP environment, one is integrated, a non-integrated, in the system environment variable fixed a PHP path, so the modification is wrong php.ini, has been unable to successfully load pdo_mysql~~~ pit dead baby!!!

Yii "Cdbconnection failed to open the DB connection:could not find driver" workaround

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.