问题
I tried asking the question php - Is there a binary package for php5-sqlite3 with fts3 enabled? - Ask Ubuntu - Stack Exchange; but no dice there - so I'll try here again in different words: how can one enable FTS3 under SQLite3 for php on an Ubuntu Linux server?
I would want to enable FTS3 for a Mediawiki using Sqlite - and I typically get the "no such module: fts3
" error.
I have found:
- how to enable sqlite3 for php? - Stack Overflow - where it is recommended that
php5-sqlite3
is removed and sqlite3 is installed from source (though no specific mention of FTS3) - Old Nabble - SQLite - FTS3 indexing in PHP < 5.3 which says:
> and here is the error:
>
> 'SQLSTATE[HY000]: General error: 1 no such module: fts3'
>There is a compile-time option: SQLITE_ENABLE_FTS3
... which, I guess, eventually says that there is no other way to activate FTS3 for SQlite3 for PHP - other than building sqlite for php from source? That would not be a good option for me, since I have no rights on the production server... which is why I'd ask again: is there some sort of a binary package to help me get FTS3 enabled?
If there isn't a binary package for that - I imagine the sqlite3 part for php will be compiled as an .so
object. Is there a way to persuade PHP to, somehow, load an "external" .so
just for a particular server directory (akin to how ini_set is used to change display_errors
locally)?
EDIT: Bonus question: Say I've installed sqlite3 with FTS3 enabled from source; will PHP show some sort of a message/indication in phpinfo()
, and what will that message be?
Thanks in advance for any answers,
Cheers!
回答1:
Use answer from how to enable sqlite3 for php? - Stack Overflow but instead of
$ sudo ./configure
you need
$ sudo CPPFLAGS="-DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS" ./configure
Credits to: sqlite - fts3 manual. Just to clarify, you don't need install separate php5-sqlite3 package because if you look into http://pecl.php.net/get/sqlite3-0.6.tgz you will see that php_sqlite3 included there. Btw, important line from INSTALL file:
Make sure you have extension=sqlite3.so in your php.ini
回答2:
You do not need to recompile the sqlite extension. You can load an extension as:
<?php
$db = new SQLite3('mysqlitedb.db');
$db->loadExtension('myExtension.so');
?>
https://secure.php.net/manual/en/sqlite3.loadextension.php
来源:https://stackoverflow.com/questions/6754212/linux-how-to-install-fts3-for-sqlite3-in-php