Skip to content

Missing PDO drivers

Greg Bowler edited this page Nov 10, 2026 · 1 revision

A database connection needs both PDO and the driver for the selected database. Having MySQL running does not mean the PHP runtime has its PDO MySQL driver enabled.

The error

Driver checks the configured driver before preparing driver-specific options or connecting. If it is unavailable, it throws GT\Database\Connection\MissingDriverException, which extends DatabaseException:

Your PHP installation does not have PDO's mysql driver installed.

The full exception includes a link to this page. It does not include the connection string, username or password.

Check the PHP runtime

Run this with the same PHP executable used by the application or command:

php -r 'print_r(PDO::getAvailableDrivers());'
php --ini

A MySQL connection needs mysql in the available-driver list. SQLite needs sqlite, and PostgreSQL needs pgsql. PHP documents this list in PDO::getAvailableDrivers().

The CLI and web server can use different PHP versions and configuration files. A successful CLI check does not establish that PHP-FPM or the web server has the same extension loaded.

Enable the driver

For MySQL, install or enable the pdo_mysql extension for the PHP version that runs the application. Use the packages provided by the operating system or the extension configuration appropriate to the PHP installation. See the PHP PDO MySQL installation documentation.

Restart the affected PHP service or application process, then check the available drivers again in that runtime. If the driver is available but the connection still fails, investigate the server address, credentials or database availability separately.

Also check that the configured driver name matches the intended database. See Configuration and connections for the supported settings.

Clone this wiki locally