Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

TLS's avatar
Level 1

PDO Exception with mysql

Hi everyone,

I didn't really know which channel fit the best for my problem so I just selected "general". I'm currently trying to deploy a website to a server which I newly installed. I got many problems, especially because I was first trying to use pgsql but i switched to MySQL. Now is the weird problem. I install mysql-server (i'm on a debian server) and php5-mysql packets. I ran the migrations and seedings which ran perfrectly.

But when I try to go on a page which execute an Eloquent request, I get a PDO Expcetion "could not found driver", which I found pretty weird considering that it worked using artisan.

Does anyone know how could that be possible ?

0 likes
1 reply
phildawson's avatar

Well you have a server and cli versions so I'm guessing it's different, and artisan would be called from cli.

If you run on cli

php -i|grep PDO
PDO support => enabled
PDO drivers => mysql, pgsql, sqlite
PDO Driver for MySQL => enabled
PDO Driver for PostgreSQL => enabled
PDO Driver for SQLite 3.x => enabled

and through phpinfo() something similar to:

PDO support enabled
PDO drivers mysql, pgsql, sqlite

PDO Driver for MySQL    enabled
Client API version  mysqlnd 5.0.11-dev - 20120503 - $Id: f373ea5dd5538761406a8022a4b8a374418b240e $
Directive   Local Value Master Value
pdo_mysql.default_socket    /var/run/mysqld/mysqld.sock /var/run/mysqld/mysqld.sock

PDO Driver for PostgreSQL   enabled
PostgreSQL(libpq) Version   9.3.5
Module version  1.0.2
Revision    $Id: fe003f8ab9041c47e97784d215c2488c4bda724d $

PDO Driver for SQLite 3.x   enabled
SQLite Library  3.8.2

Please or to participate in this conversation.