Red Hat Bugzilla – Bug 187681
Php pdo sqlite can't open sqlite command-line created databases
Last modified: 2007-11-30 17:11:29 EST
Description of problem:
You can't open a sqlite database from a php script if the database has been
created by the sqlite command.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create a database from the command-line:
$ sqlite3 test.sql
sqlite> create table test_table(a);
2. Create a php script (script.php):
$db = new PDO('sqlite:./test.sql');
$query = $db->query('select * from test_table');
$arr = $db->errorInfo();
3. Run the script.
$ php script.php
The file format is not recognized.
 => HY000
 => 1
 => unsupported file format
I think the sqlite pdo module has to be built against the last sqlite libraries.
php-pecl-pdo-sqlite is an old Extras package. Update to "php-pdo" and you'll
get the PDO sqlite3 interface, which should work.