php php致命错误:类sqlite3未在

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19565250/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 19:43:40  来源:igfitidea点击:

php fatal error: class sqlite3 is not found in

phpubuntusqliteubuntu-12.04lamp

提问by harishkumar329

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

我使用 ubuntu 12.04 和 php 5.x 我需要在其中使用 sqlite3 但我收到错误

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.

先感谢您。

回答by harishkumar329

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.

并且只使用 sqlite3 类......现在没问题。

回答by Bessem Bousselmi

  • 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
      
  • 第1步 :

    • 对于 PHP5,使用

      sudo apt-get install php5-sqlite
      
    • 对于 PHP7.0,使用

      sudo apt-get install php7.0-sqlite
      
    • 对于 PHP7.1,使用

      sudo apt-get install php7.1-sqlite
      
    • 对于 PHP7.2,使用

      sudo apt-get install php7.2-sqlite
      
    • 对于 PHP7.3,使用

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

    • 重启阿帕奇

      sudo service apache2 restart
      

回答by Vasili Pascal

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

即使我安装了所有库,我也遇到了同样的问题。如果你运行 php-fcgi,你应该重新启动它:

sudo service php-fcgi restart

Try also restart apache:

也尝试重新启动 apache:

sudo service apache restart 

回答by noraj

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

对于ArchLinuxPHP Fatal error: Uncaught Error: Class 'SQLite3' not found in /path/file.php:1上的错误:

Install the sqlite extension for PHP:

为 PHP 安装 sqlite 扩展:

$ sudo pacman -S php-sqlite

Then edit /etc/php/php.iniand add:

然后编辑/etc/php/php.ini并添加:

extension=pdo_sqlite
extension=sqlite3

Source: 1

资料来源:1

回答by Pavel Alazankin

For php5.6 use:

对于 php5.6 使用:

sudo apt-get install php5.6-sqlite3

回答by AVKurov

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.iniand start the script again.

我有同样的错误。如果您使用的是 Windows,请不要忘记取消注释php_sqlite3.dll(和可选php_pdo_sqlite.dll)扩展名php.ini. 保存php.ini并再次启动脚本。

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

(我将此答案添加到带有ubuntu标签的问题中,因为此问题在 google 中针对请求排在首位php sqlite3 not found)。