SQLite3::loadExtension

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

SQLite3::loadExtensionAttempts to load an SQLite extension library

说明

public SQLite3::loadExtension ( string $name ) : bool

Attempts to load an SQLite extension library.

参数

name

The name of the library to load. The library must be located in the directory specified in the configure option sqlite3.extension_dir.

返回值

Returns true if the extension is successfully loaded, false on failure.

范例

Example #1 SQLite3::loadExtension() example

<?php
$db 
= new SQLite3('mysqlitedb.db');
$db->loadExtension('libagg.so');
?>

User Contributed Notes

RollingHog 12-May-2020 06:51
One more addition. If you need to setup non-thread-safe PHP on XAMPP/Apache to use loadextension, look at this article: https://paulshipley.id.au/blog/coding-tips/improve-php-performance-with-fastcgi-on-xampp-for-windows/

Tl;dr - you need to install&configure mod_fcgid module for Apache.
RollingHog 08-May-2020 07:15
For newbies like me: if loadExtension fails with "Not supported in multithreaded Web servers" message (which always happens on IIS and sometimes - on Apache), you need to use non-thread-safe build of PHP, which is not always a bad idea; see https://www.geeksforgeeks.org/what-is-thread-safe-or-non-thread-safe-in-php/
PHP8中文手册 站长在线 整理 版权归PHP文档组所有