How do I install PDO drivers for PHP on Windows?

How do I install PDO drivers for PHP on Windows?

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

How do I install PDO drivers for PHP on Windows?

You've set up your stack: Apache, PHP 5.6, and MySQL 5.7 running on Windows. You've updated your php.ini to include extension=php_mysql.dll, extension=php_mysqli.dll, extension=php_pdo_mysql.dll, and others, then restarted the web server. Yet, when you attempt to query a database, you're met with a PDOException stating that the driver could not be found.

This error often confuses developers because they see pdo_mysql.dll listed in their configuration file and assume the extension is loaded. However, simply uncommenting a line in php.ini isn't enough; the corresponding DLL file must physically exist in the PHP extensions directory, and it must match your exact PHP build architecture.

The error message "could not find driver" specifically points to a missing or incompatible binary. In many Windows installations, users download generic PDO packages without verifying if they align with their specific PHP version's thread safety settings or bit depth (32-bit vs 64-bit). If you installed a 64-bit PHP build but loaded a 32-bit php_pdo_mysql.dll, the server will either fail to load it during startup or throw this fatal error upon runtime usage.

To resolve this, you must first identify your PHP architecture. Run phpinfo() in your browser or check the output of php -i via the command line. Look for "Architecture" in the configuration summary. If it says "64-bit", ensure your downloaded extensions are explicitly marked as 64-bit. Once verified, extract the correct .dll files into your PHP root directory, typically C:\wamp\bin\php\php5.6.x\ext or wherever your installation places extensions.

After placing the files, a restart of Apache is mandatory. You must also ensure that the lines in php.ini are not commented out. A common pitfall is enabling extension=php_pdo_mysql.dll but leaving extension=php_mysql.dll disabled when legacy code relies on it. While PDO is the recommended standard for database abstraction, mixing old and new extensions requires careful management to avoid conflicts.

Another frequent issue involves loading order. Although modern PHP versions are generally forgiving regarding extension load order, some older builds or specific Windows configurations require that the core php_pdo.dll be loaded before the specific driver modules like php_pdo_mysql.dll. If you have a custom-compiled PHP build from source on Windows, verify that the PDO base library was compiled with your MySQL client libraries.

If you are using a pre-packaged distribution like XAMPP or WAMP, ensure you haven't accidentally disabled these extensions in the GUI manager. Sometimes the interface hides the DLL files by default, leading to the "missing driver" illusion even when they exist on disk.

For production environments, relying on community-sourced binary packages can be risky due to version mismatches. Consider compiling PHP from source if you need specific driver support that isn't available as a drop-in DLL. This gives you full control over which libraries are linked against your build.

If you are building an application with Laravel or Symfony, the framework's documentation often assumes these extensions are present by default. If you encounter issues here, check the php.ini in the specific virtual host or PHP-FPM pool configuration, not just the global one. Ensure that the web server process is actually reading the updated configuration file and not a cached version from a previous deployment.

For further guidance on configuring your PHP environment for modern frameworks, you might find useful resources at https://laravelcompany.com regarding their specific hosting requirements and extension recommendations.

Our network