skip to Main Content

I’ve tried to connect to my database using basic code and error checking but when I try it gives this error :

Could not find driver"

even when I enable extension=pdo_mysql.

By the way, when I do phpInfo(); it says that I’m on 8.0.30 if this can help.

Also, it says that the pdo drivers has novalue.

2

Answers


  1. Make sure you have the pdo_mysql library installed in your PHP ext/ folder. If it exists, you may have a typo in your php.ini file (you need to uncomment extension=pdo_mysql). Otherwise, you might first need to install the appropriate PDO database drivers.

    You can try list your extensions using php -m to ensure that PHP detects the library.

    Login or Signup to reply.
  2. You can also try the following command to ensure library is loaded and enabled.

    php --ri pdo_mysql
    
    pdo_mysql
    
    PDO Driver for MySQL => enabled
    Client API version => mysqlnd 8.2.7
    

    otherwise:

    php --ri pdo_mysql
    Extension 'pdo_mysql' not present.
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search