Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

531
Views
Cannot loadExtension in SQLite3 module, PHP

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');.

  • Doesn't work on my XAMPP/Apache with error Not supported in multithreaded Web servers, albeit it is done especially for this. What can be wrong in XAMPP/Apache configuration?
  • On one not so well-known HTTP server it returns 'Unable to load extension' because of non-standard entry point. Can I specify custom entry point somehow?

Second approach: $dbconn->exec("SELECT load_extension('example.dll', 'custom_init');");.

  • Fails with error 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?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

  • "Not supported in multithreaded Web servers"

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.

  • 'Unable to load extension' because of non-standard entry point. Can I specify custom entry point somehow?

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.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!