Running SQLite 3 in MicroApache

I am running MicroApache ( http://microapache.amadis.sytes.net ) on Windows XP and would like to use SQLite 3 databases.

PHP version is 5.2.9-2.

My MicroApache version supports SQLite 2 via 2 lines in php.ini:
extension = php_pdo.dll
extension = php_sqlite.dll

I am checking if the extension works in 3 ways:
1. phpinfo ()
2. extension_loaded () and get_loaded_extensions ()
3. using example code which var_dump () s is a SQLITE3_NUM constant (must be integer 2) and tries to create a database ( error: class SQLite3 does not exist)

Things I've tried (if I can remember them):
1.copy php_sqlite3.dll from full PHP install and added "extension = php_sqlite3.dll" in php.ini
  -> error "Point entry error gc_remove_zval_from_buffer not found in php5ts.dll "
2. Compressed DLL with UPX (like other MicroApache DLLs for example)

  -> does not show error on startup, nor in log file, but doesn't work
3. Tried various things with php.ini
- created section" [sqlite3] "
is the prefix" sqlite3 ". to "extension_dir =." and "extension = php_sqlite3.dll"
-...
4. tried to use PDO, it says "couldn't find driver"

Can anyone help me get SQLite 3 to work?

+2


a source to share


3 answers


The problem of connecting to SQLite 3 DB and similar issues is addressed and discussed in a forum entitled "Connecting to SQLite3 Database from PHP 5.25" This may answer some of your queries.

The latest version of SQLite is compiled in PHP5 and enabled via PDO.

It displays in PHPINFO.PHP as

2.0-dev "$ Id: sqlite.c, v 1.166.2.13.2.12 2008/12/31 11:17:44 sebastian Exp $"

Sounds more like a test code problem. Have you cross-checked by running a SQLite system with standard Apache and the same PHP version? What are the results from phpinfo()

, etc.

Recent MicroApache distributions come with a PHP / SQLite guestbook as a demo / test. Doesn't this work?

Think about it, you might not have noticed there is a SQLite distribution. Why not go back to the site and check other versions (just unzip and run).

As always, I point out that MicroApache is not intended to be used on a public web server without paying too much attention to security configuration. It was only designed as a way to share information locally via a floppy disk or USB stick. It's easy enough to harden.

I'm sure you know that the SQLite developer has renamed a number of functions since the advent of SQLite3, including a public function - (See here: Introduction to the SQLite C / C ++ Interface ). I'm not sure how this was implemented by the PHP developers, including this codebase in PHP. The suggestion from the page above is that you can open the PHp3 DB "as is" with the correct PHP code.

Mixing DLLs from different PHP distributions is not recommended. I do not recommend any other use of the MicroApache distribution than "as is". Adding or mixing DLL files from different PHP versions, etc. MicroApache can lead to serious bugs or security issues.



There is little or no interest in SQLite with MicroApache, so I really didn't get too deep into it other than to test the functionality. I don't rely too much on what is reported phpinfo()

.

Perhaps you can update your information to confirm if the exact version is the version.

Update

I had time to research a bit more and the discussion of php5-sqlite3 on the Mac OS Forge mailing list answers your problem.

PHP implementation is partial and poorly documented. Some of the SQLite3 procedural function calls only propagate to the object hierarchy. The procedural API only offers the ability to open SQLite 2 DB, so you are stuck with using objects by appearance.

There is also a PECL extension, php-sqlite3, which was developed during 2008, currently version 0.6. This is what the php5-sqlite3 port is installed. But this does not provide sqlite3_open with the function you are looking for. Rather, it provides an object-oriented interface based on three classes: SQLite3, SQLite3Stmt, and SQLite3Result. This one described here is rather incomplete, in particular, the installation instructions are completely missing:

Hope you can play with these distros and solve your problems.

The distribution includes a SQLite3.DLL distribution that can be obtained directly from VB5 / 6 or any compatible language that a DLL might call.

This was a separate project that I studied recently. This was done in MSVC by editing the original source. This DLL is incompatible with PHP / PDO, but can be used through the CGI interface. Alternatively, the original SQLite 3 DLL can be accessed and used through Delphi, etc.

+2


a source


Remember that I have a SQLite-enabled distribution. However, it only supports version 2 and not 3.

My MicroApache version supports SQLite 2 [...]



I would like to use SQLite 3 because it is faster, I could interact with the databases I created for the project in Delphi and I could access the newly created databases using the SQLite Manager Firefox extension.

0


a source


I fiddled with this issue a little more, but couldn't create / access a SQLite 3 database.

Interestingly, the link given in Part 1 mentions the SQLiteDatabase class, which is not found in the PHP documentation and is not part of the SQLite3 extension (which is object oriented - as mentioned in your last post, Mad Max).

"SQLiteDatabase" creates a database, but when you open it, you can see that it is in version 2.1.

Thanks for the help.

EDIT:
PDO only works when I use the "sqlite2" DSN prefix, which is not surprising since phpinfo () only lists the "sqlite2" driver in the "PDO" section.

0


a source







All Articles