給像我一樣的新手:如果 loadExtension 失敗並顯示「多執行緒 Web 伺服器不支援」訊息(這在 IIS 上總是發生,有時在 Apache 上也會發生),您需要使用非執行緒安全版本的 PHP,這並非總是壞主意;請參閱 https://www.geeksforgeeks.org/what-is-thread-safe-or-non-thread-safe-in-php/
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SQLite3::loadExtension — 嘗試載入 SQLite 擴充函式庫
name
要載入的函式庫名稱。該函式庫必須位於 sqlite3.extension_dir 設定選項指定的目錄中。
範例 #1 SQLite3::loadExtension() 範例
<?php
$db = new SQLite3('mysqlitedb.db');
$db->loadExtension('libagg.so');
?>
給像我一樣的新手:如果 loadExtension 失敗並顯示「多執行緒 Web 伺服器不支援」訊息(這在 IIS 上總是發生,有時在 Apache 上也會發生),您需要使用非執行緒安全版本的 PHP,這並非總是壞主意;請參閱 https://www.geeksforgeeks.org/what-is-thread-safe-or-non-thread-safe-in-php/
再補充一點。如果您需要在 XAMPP/Apache 上設定非執行緒安全版本的 PHP 以使用 loadextension,請參閱這篇文章: https://paulshipley.id.au/blog/coding-tips/improve-php-performance-with-fastcgi-on-xampp-for-windows/
簡而言之 - 您需要為 Apache 安裝並設定 mod_fcgid 模組。