how to enable sqlite3 for php?

前端 未结 15 771
野性不改
野性不改 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:03

    For Ubuntu 18.04 and PHP 7.2:

    sudo apt install php-sqlite3

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

    The accepted answer is not complete without the remainder of instructions (paraphrased below) from the forum thread linked to:

    cd /etc/php5/conf.d
    
    cat > sqlite3.ini
    # configuration for php SQLite3 module
    extension=sqlite3.so
    ^D
    
    sudo /etc/init.d/apache2 restart
    
    0 讨论(0)
  • 2020-11-28 04:06

    In Centos 6.7, in my case the library file /usr/lib64/php/modules/sqlite3.so was missing.

    yum install php-pdo 
    
    vim /etc/php.d/sqlite3.ini
    ; Enable sqlite3 extension module
    extension=sqlite3.so
    
    sudo service httpd restart
    
    0 讨论(0)
  • 2020-11-28 04:06

    For Debian distributions. Nothing worked for until I added the debian main repositories on the apt sources (I don't know how were they removed): sudo vi /etc/apt/sources.list

    and added

    deb  http://deb.debian.org/debian  stretch main
    deb-src  http://deb.debian.org/debian  stretch main
    

    after that sudo apt-get update (you can upgrade too) and finally sudo apt-get install php-sqlite3

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

    The Debian/Ubuntu way for php-7.2, php-7.3 & php-7.4 (e.g. the [234] part)

    sudo apt install php7.[234]-sqlite
    sudo phpenmod sqlite3
    

    Be sure to note that on Windows Subsystem for Linux version 1 (WSL1) the (file-)locking system for SQlite is broken.

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

    Try:

    apt-get install php5-sqlite
    

    That worked for me.

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