php fatal error: class sqlite3 is not found in

2020-04-02 17:05发布

Im using ubuntu 12.04, and php 5.x I need to use sqlite3 in it but Im getting an error of

php fatal error: class sqlite3 not found

I done all the installation processes,

like

$ 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

and

cd /etc/php5/conf.d

cat > sqlite3.ini
# configuration for php SQLite3 module
extension=sqlite3.so
^D

sudo /etc/init.d/apache2 restart

now what else I want to do???

Can anyone please help me to fix this...

Thankyou In advance.

6条回答
ゆ 、 Hurt°
2楼-- · 2020-04-02 17:26

Found a solution my self,

I installed

 $ sudo apt-get install php5-sqlite

not

 $ sudo apt-get install php5-sqlite3

and using sqlite3 class only.. no issue now.

查看更多
可以哭但决不认输i
3楼-- · 2020-04-02 17:26

For the error PHP Fatal error: Uncaught Error: Class 'SQLite3' not found in /path/file.php:1 on ArchLinux:

Install the sqlite extension for PHP:

$ sudo pacman -S php-sqlite

Then edit /etc/php/php.ini and add:

extension=pdo_sqlite
extension=sqlite3

Source: 1

查看更多
霸刀☆藐视天下
4楼-- · 2020-04-02 17:27
  • Step 1 :

    • For PHP5, use

      sudo apt-get install php5-sqlite
      
    • For PHP7.0, use

      sudo apt-get install php7.0-sqlite
      
    • For PHP7.1, use

      sudo apt-get install php7.1-sqlite
      
    • For PHP7.2, use

      sudo apt-get install php7.2-sqlite
      
    • For PHP7.3, use

      sudo apt-get install php7.3-sqlite
      
  • Step 2 :

    • Restart Apache

      sudo service apache2 restart
      
查看更多
放荡不羁爱自由
5楼-- · 2020-04-02 17:36

I had the same error. If you are on Windows, don't forget to uncomment php_sqlite3.dll (and optionally php_pdo_sqlite.dll) extension in php.ini. Save php.ini and start the script again.

(I added this answer to the question with the ubuntu tag because this question is on the first place in google for the request php sqlite3 not found).

查看更多
走好不送
6楼-- · 2020-04-02 17:42

I had the same problem even I have installed all libraries. If you run php-fcgi, you should restart it:

sudo service php-fcgi restart

Try also restart apache:

sudo service apache restart 
查看更多
何必那么认真
7楼-- · 2020-04-02 17:42

For php5.6 use:

sudo apt-get install php5.6-sqlite3
查看更多
登录 后发表回答