I need to use extension example.dll
with SQLite3 object in PHP. Extension has non-standard entry point custom_init
. sqlite3.extension_dir
in php.ini is specified properly. Tried the following code:
$dbconn = new SQLite3('test.db');
$dbconn->loadExtension('example.dll');
$dbconn->exec("SELECT load_extension('example.dll');");
As one can see, I used two approches to load it.
First approach: $dbconn->loadExtension('sqldba.dll');
.
Not supported in multithreaded Web servers
, albeit it is done especially for this. What can be wrong in XAMPP/Apache configuration?Second approach: $dbconn->exec("SELECT load_extension('example.dll', 'custom_init');");
.
not authorized
. Is there any way to call sqlite3_enable_load_extension here? I can't find such function in "SQLite for PHP" module documentation.Upd: somehow related: How to load sqlite extension in PDO?
This won't work on IIS anyway, which is (apperently) preferable for me. According to this (line 414) it is only enabled in ZTS(Zend Thread Safety). Disabling it is discussed here. Still no idea what's wrong with Apache config.
Nnnope. Maybe someone should add a "custom entry point" feature request to PHP tracker, it doesn't seem that difficult.
"SELECT load_extension('example.dll', 'custom_init');"
- fails with error "not authorized".You have to call sqlite3_enable_load_extension
before doing load_extension from query, and there is no analogue of sqlite3_enable_load_extension
in php-sqlite. Patching PDO-Sqlite for this is described here, but it's very unsafe. Adding this as new feature in php-sqlite would be much better.