how to enable sqlite3 for php?

前端 未结 15 773
野性不改
野性不改 2020-11-28 03:53

I am trying to install sqlite3 for PHP in Ubuntu.

I install apt-get php5-sqlite3 and edited php.ini to include sqlite3 extension.

W

相关标签:
15条回答
  • 2020-11-28 04:26

    The SQLite3 PDO driver is named SQLite, not SQLite3, so you can do:

    new SQLite("database");
    

    For a SQLite2 database:

    new SQLite2("database");
    
    0 讨论(0)
  • 2020-11-28 04:26

    This will drown here, but I fixed my problems with this:

    As far as I have found out, there is a faulty file in /usr/local/lib called libsqlite3.so.0 which points to libsqlite3.so.0.8.6. It's been installed through the php7.3-* packages as far as I can tell.

    I renamed the file in case it was needed for something. With the command:

    cd /usr/local/lib sudo mv libsqlite3.so.0 ./libsqlite3.so.0.back

    But you can also just delete it: rm libsqlite3.so.0

    The thread that lead me to the answer: link

    This solved my problems, and I hope they solve yours as well :)

    0 讨论(0)
  • 2020-11-28 04:29

    Edit: This answer is outdated, but can't be removed because it's accepted. Please see the solution from Stacey Richards for the correct answer.

     sudo apt-get install php5-cli php5-dev make
     sudo apt-get install libsqlite3-0 libsqlite3-dev
     sudo apt-get install php5-sqlite3
     sudo apt-get remove php5-sqlite3
     cd ~
     wget http://pecl.php.net/get/sqlite3-0.6.tgz
     tar -zxf sqlite3-0.6.tgz
     cd sqlite3-0.6/
     sudo phpize
     sudo ./configure
     sudo make
     sudo make install
     sudo apache2ctl restart
    

    Ripped from the ubuntu form.

    0 讨论(0)
提交回复
热议问题