0

I have installed sqlite db on my server and can access the tables and data without any issues. But when i try to access it through a PHP script, I get an error - Fatal Error: 'SQLite3' is an unknown class name. Is anyone aware of this error and reasons for it to occur?

<?php header('Access-Control-Allow-Origin: *');

echo "Connected successfully";

$db=new SQLite3('/npu/dex/database/npu.sqlite3');   // Error : Fatal Error: 'SQLite3' is an unknown class name
echo "SQLite 3 supported.";


?>
fusion3k
  • 11,568
  • 4
  • 25
  • 47
Goutam
  • 1,337
  • 8
  • 22
  • 41
  • What version of PHP? – Michael Hommé Apr 12 '16 at 21:21
  • Ok, is the extension is enabled? Check your php.ini file for this line and make sure it's not commented out. `extension=php_sqlite3.dll`. If it is, uncomment it, then restart Apache. – Michael Hommé Apr 12 '16 at 21:23
  • @mikehomme Yes, I checked it and its uncommented – Goutam Apr 12 '16 at 21:24
  • Do you use a standard php implementation? “... is an unknown class name” is not a standard php message – fusion3k Apr 12 '16 at 21:39
  • @fusion3k Yea i do, I dint get any error when i executed the program in my local system. When i deployed this on server, i get the error. – Goutam Apr 12 '16 at 21:40
  • I know you said the extension is enabled, but to test this, I'd try to reproduce the error locally by intentionally commenting out the extension. – Michael Hommé Apr 12 '16 at 21:44
  • Better yet, run `phpinfo()` on the server and verify that the module is installed. – Michael Hommé Apr 12 '16 at 21:48
  • [“is an unknown class name” seems to be from TomCat/Quercus](https://www.google.com/search?q=PHP+Fatal+Error:+%22is+an+unknown+class+name+%22) – fusion3k Apr 12 '16 at 21:50
  • @fusion3k when i run phpinfo, i have server software as Apache PHP Quercus(Open Source 4.0.39). Is there any issue with this? – Goutam Apr 12 '16 at 21:57
  • I don't know Quercus, but it is a Java implementation of php. It doesn't have SQLite3 pre-installed. You have to search for solutions or to ask to your server provider. Consider using PDO instead. I have added 'quercus' tag to the question: maybe someone can be more helpful. – fusion3k Apr 12 '16 at 22:11

0 Answers0