Hello,

I need json functions badly in SQLite. I successfully installed the latest
version of SQLite with "brew install sqlite3 --with-json1 --with-ft5" and
now I can run json functions in console.

But also I need to do that via PHP. So I installed php-sqlite with "sudo
port install php70-sqlite". I don't know if it is compatible with json
functions because when I try to execute below code It says "Warning:
SQLite3::exec(): no such function: json".

<?php
    $db  = new SQLite3("sqlite");

    $sql = "create table user(name,phone);";
    //$db->query("SELECT load_extension('myextension.so');");
    $sql = 'insert into user (name, phone) values("oz",
json(\'{"cell":"+491765", "home":"+498973"}\'));';
    $db->exec($sql);?>

I am on the edge of given up. The last thing I tried is
downloading php-7.0.5.tar.bz2 and trying compile sqlite in ext folder by
myself. I moved produced "sqlite3.so" in "modules" folder to
"/opt/local/lib/php70/extensions" and looked at php info if it is work or
not.

Surprisingly it was work but it says SQLite Library Version 3.8.10.2. You
can see complete result in here <http://typop.net/lab/info.html>. I need at
least 3.9 to run json functions right? It must be 3.12 because I downloaded
latest php. Really confused. Maybe you can tell me what can I do at this
point.

I also downloaded sqlite-autoconf-3120100.tar.gz to try compile sqlite3.so
but I really could not find the file I must deal with. I am just a designer
who writing code just for hobby.

Sorry about this lame question but google is not helping anymore.

Cheers

Reply via email to