views:

522

answers:

2

I know PHP 5 already supports SQLite but for some reason I can't get it to work. I followed the instructions from http://www.scriptol.com/sql/sqlite-getting-started.php. I also made sure that the following are not commented out from php.ini: extension=php_pdo_sqlite.dll and extension=php_sqlite.dll. But when I open the PHP file from localhost using Firefox, I get this error: Fatal error: Class 'SQLiteDatabase' not found. I'm on Windows by the way, if that info matters.

What may be the cause of this problem? Thank you.

+1  A: 

I think the class SQLiteDatabase is from the extension sqlite rather pdo_sqlite. So you could enable the sqlite extension, or use PDO instead:

<?php
$conn = new PDO('sqlite:c:/mydb.sq3');
$conn->exec('some sql query');
Tom Haigh
Thanks a lot! I think I was able to get past opening the db because now the errors pertain to the query! Now I just have to learn the syntax and all! Thanks again!
Jarvis
+1  A: 

On Windows you need to have the following set in your ini:

extension=php_pdo.dll
extension=php_sqlite.dll

I recommend you read this page in the manual.

Kieran Hall