php fatal error: class sqlite3 is not found in

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 

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


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.


  • 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