PDO connection data error could not find driver solution

Source: Internet
Author: User

Turn this module on and restart Apache.

There is only one reason for this error, that is PDO the corresponding database expansion did not load in, do not suspect PDO error, if you are in the process of using PDO encountered could not find driver error, the following troubleshooting to get to help you solve the problem.

Troubleshooting Item One: whether to install the corresponding driver

Under Windows General Pdo_mysql.dll is self-contained, so remove the semicolon can be directly loaded in, but under Linux, you have to make sure that you have installed the pdo_mysql extension of PHP, otherwise loading does not come in.

Troubleshooting Item Two: whether to load the corresponding driver

In general, everyone uses MySQL, so PDO's driver is pdo_mysql, so you need to include this extension when you start PHP.
Check PHP.ini to see if this extension is included, you need to remove the semicolon in front of the Pdo_mysql.dll, and add extension= ' pdo_mysql.so ' on Linux.

Troubleshoot item Three: The configuration file loaded under the command line is correct

On the Linux platform we can execute the PHP program at the command line, sometimes encounter in the normal browser access Php,pdo will not be reported could not found driver, but execute PHP at the command line will be error could not find driver, This is usually the time to execute PHP loaded PHP configuration file is not correct

Other ways to troubleshoot

If the above detection is correct, still error could not find driver, so congratulations you are a lucky child, encounter this problem you can go to see the error log, more Baidu, or Google, may solve the problem, of course, solve the problem also welcome to share here, I'll sort it all out.

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.