How to enable the PDO driver for sqlite3 in php?

How to enable the PDO driver for sqlite3 in php?

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

Stefan Bogdanescu

Founder & Senior Architect

How to Enable the SQLite3 PDO Driver in PHP

If your phpinfo() output shows that the PDO SQLite extension is missing, it usually isn't because the driver itself is broken or needs a magical "enable" toggle within PHP. Instead, the issue lies with the Apache configuration file, specifically the LoadModule directive. In environments like XAMPP, which bundles PHP and Apache together, extensions are often compiled as shared libraries (.so files) that must be explicitly loaded by the web server. Without this explicit instruction, Apache simply never initializes the module, and PHP reports no support for SQLite via PDO.

The most direct way to verify this is to check your httpd.conf file or an included configuration directory like extra/httpd-ssl.conf (depending on your XAMPP version). You need to ensure the following line exists and points to the correct shared object file:

LoadModule php5_module "modules/php5lib.dll"

More importantly, you must locate the specific SQLite driver module. In modern PHP installations on Windows (common with XAMPP), this is usually a separate DLL file named php_pdo_sqlite.dll. If this line is missing from your configuration or commented out with a semicolon, Apache will not load the capability to handle SQL queries against SQLite databases using PDO.

Once you have located the file in your XAMPP installation folder—typically under extensions or php\extras\sqlite3—you should uncomment and verify the corresponding line in httpd.conf:

LoadModule pdo_sqlite_module "modules/php_pdo_sqlite.dll"

After making changes to the configuration file, you cannot expect the change to take effect immediately. You must restart the XAMPP Control Panel services. Stopping the Apache service and starting it again forces the server to re-read the httpd.conf file and load the new modules into memory. Failure to restart the service is a frequent oversight that leads developers to believe their configuration changes had no impact.

However, enabling the module in Apache is only half the battle; you must also ensure PHP recognizes the extension at runtime. Open your php.ini file (often found in the root of the XAMPP installation or within the php folder). Look for a line resembling:

extension=php_pdo_sqlite.dll

If this line is commented out, remove the semicolon to activate it. Conversely, if you see an older-style configuration like pdo_sqlite.so, ensure you are using the correct syntax for your operating system. On Windows, extensions typically end in .dll.

It is also worth noting that PHP and SQLite versions must be compatible. The source material mentions SQLite 3.4.0, which is quite ancient (released around 2009). While PDO can technically work with older SQLite drivers, modern PHP versions often drop support for very old SQLite libraries or require specific build flags to include them. If you encounter a fatal error stating "The SQLite3 extension is not loaded," double-check that the DLL file actually exists in your php folder and that its architecture (32-bit vs 64-bit) matches your PHP binary. Mixing architectures here will result in immediate crashes, not just missing functionality.

If you are building a Laravel application on top of this stack, ensure your database configuration points to a valid .sqlite file path rather than a URL or abstract connection string, as the PDO driver expects a local file path for SQLite. While there are many commercial hosting providers that handle these configurations automatically, running XAMPP locally requires you to manage these low-level details manually.

For those looking for more robust database management within the Laravel ecosystem, consider exploring resources like https://laravelcompany.com which often provides guides on managing database migrations and connection pooling strategies once your drivers are correctly configured.

Our network