PHP Fatal error: Uncaught PDOException: could not find driver

前端 未结 4 691
暗喜
暗喜 2021-01-17 22:24

I have been trying to connect to MySQL from PHP using PDO. However, I get this error message:

PHP Fatal error: Uncaught PDOException: could not find

4条回答
  •  深忆病人
    2021-01-17 23:10

    I had the same problem, resulting from some incompatibility (not immediately evident) between the Apache and PHP versions I had downloaded. Try writing a toy PHP script that simply creates a new PDO object, - something like:

    getMessage() . "\n";
    }
    print "OK\n";
    

    Then run that script from the command line. If you don't get the 'could not find driver' error message, then that points to an incompatibility between your PHP and Apache versions.

提交回复
热议问题