note 68780 added to ref.pdo-sqlite

From: Date: Thu, 10 Aug 2006 14:38:19 +0000
Subject: note 68780 added to ref.pdo-sqlite
Groups: php.notes 
Request: Send a blank email to php-notes+get-115759@lists.php.net to get a copy of this message
Issue: Error: SQLSTATE[HY000]: General error: 1 unsupported file format Resolution: To solve this (and/or many issues) involving this type of error, I assumed the error to be generated from php. Well, it was to an extent. The sqlite pdo code offered the solution: I researched the error by grep'ing the php source code and found the error string to come from php-5.1.4/ext/pdo_sqlite/sqlite/src/prepare.c, lines 265:278 : /* ** file_format==1 Version 3.0.0. ** file_format==2 Version 3.1.3. ** file_format==3 Version 3.1.4. ** ** Version 3.0 can only use files with file_format==1. Version 3.1.3 ** can read and write files with file_format==1 or file_format==2. ** Version 3.1.4 can read and write file formats 1, 2 and 3. */ if( meta[1]>3 ){ sqlite3BtreeCloseCursor(curMain); sqlite3SetString(pzErrMsg, "unsupported file format", (char*)0); return SQLITE_ERROR; } This is interesting as I am running SQLite version 3.3.5 which the databases were created in. I see that the SQLite PDO source in the php source is : # cat ext/pdo_sqlite/sqlite/VERSION 3.2.8 My solution was then to find a version of sqlite that was =< 3.1.4. I found source for 3.1.3, compiled, recreated my database using that version (NOTE: the databases are unsupported between 3.1.x and 3.2.x versions of SQLite). Once I did this it worked. Also as a side note, to get SQLite compiled as a PDO, I had to: 1) configure with ... --enable-pdo=shared \ --with-sqlite=shared \ --with-pdo-sqlite=shared --with-zlib ... \ 'make && make install' if configure is successful. 2) Make sure the pdo libs were copied/installed to the correct directory. On my installation it was /usr/local/include/php/ext/pdo/ 3) Make these changes in my php.ini: - change ' extension_dir = "./" ' to ' extension_dir="/usr/local/include/php/ext/pdo/" ' - add/edit in this order: extension=pdo.so extension=pdo_sqlite.so extension=sqlite.so 4) test php with : 'php -m' at the command line and solve any issues from there. Mostly php.ini config issues. Also restart the http service! ---- Server IP: 66.163.161.117 Probable Submitter: 24.197.133.190 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/ref.pdo-sqlite.php Edit -- https://master.php.net/note/edit/68780 Del: integrated -- https://master.php.net/note/delete/68780/integrated Del: useless -- https://master.php.net/note/delete/68780/useless Del: bad code -- https://master.php.net/note/delete/68780/bad+code Del: spam -- https://master.php.net/note/delete/68780/spam Del: non-english -- https://master.php.net/note/delete/68780/non-english Del: in docs -- https://master.php.net/note/delete/68780/in+docs Del: other reasons-- https://master.php.net/note/delete/68780 Reject -- https://master.php.net/note/reject/68780 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#115759) next »