phplinuxsqliteinstallationfts3

LInux: How to install FTS3 (for sqlite3) in PHP?


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:

> 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!


Solution

  • 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