1

I am having problems using sqlite when running my php-files on the localhost (Windows 7 IIS). I have installed IIS, PHP 5.3, xdebug and enabled sqlite in IIS manager. My IDE is phpStorm. PHP works fine. But after the line

$db = new PDO('sqlite:new.db');

$db = {PDO} [0]. After that, $db->query($query, SQLITE_BOTH, $error) gives an empty $error, which is what I can understand. However I do not understand why new PDO does not work and does not return any error either. The database is in the root folder, the very same code works on the internet.

Just to be sure, here is the phpinfo output on sqlite:

PDO support   enabled
PDO drivers   mysql, sqlite, sqlsrv, sqlite2

Any idea what can be wrong?

texnic
  • 3,959
  • 4
  • 42
  • 75
  • try suggestions in http://stackoverflow.com/questions/929585/how-to-enable-the-pdo-driver-for-sqlite3-in-php – Cups Sep 19 '12 at 10:40
  • @Cups: In my case, PDO is already installed: `PDO drivers mysql, sqlite, sqlsrv, sqlite2` if I understand it correctly. – texnic Sep 19 '12 at 10:48

1 Answers1

3

I had the same issue. To make it work, I went in this section of php.ini, editing it with permission of Administration:

[ExtensionList]
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_mbstring.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_curl.dll
extension=php_exif.dll
extension=php_xmlrpc.dll
extension=php_openssl.dll
extension=php_soap.dll
extension=php_pdo_mysql.dll
extension=php_pdo_sqlite.dll
extension=php_imap.dll
extension=php_tidy.dll

and I added the following line

extension=php_sqlite3.dll

Then I want to the following section:

[sqlite3]
sqlite3.extension_dir = 

Was empty as it is above, and I changed it into

[sqlite3]
sqlite3.extension_dir = "C:\Program Files (x86)\PHP\v5.6\ext\"

now it works ...

Tormy Van Cool
  • 658
  • 10
  • 29