0
I have the code below supposedly simple. The intuition is to create a table include values and soon after showing the information, but in the log apache is showing the following:
[:error] [pid 17622] [client 10.1.21.1:42895] PHP Fatal error: Uncaught Error: Class 'SQLite3' not found in /var/www/html/acesso.php:2\nStack trace:\n#0 {main}\n thrown in /var/www/html/acesso.php on line 2
<?php
$db = new SQLite3('test.db');
$db->exec('CREATE TABLE test (id INT, message STRING)');
$db->exec("INSERT INTO test (id, message) VALUES ('1', 'test message')");
$db->exec("INSERT INTO test (id, message) VALUES ('2', 'test message 2')");
$results = $db->query("SELECT * FROM test WHERE ID = 2");
print_r($results->fetchArray());
?>
PHP Summer : 7.0
OS Version : Ubuntu 16.10
Sqlite version installed: 3.14.1
Apache Version: Apache/2.4.18 (Ubuntu)
Give phpinfo() and see if sqlite mode is installed
– Paulo Sérgio Duff
After using phpinfo() and confirming that the extension for Sqlite is not enabled just remove the comment "Extension=php_pdo_sqlite.dll" in php.ini and restart apache
– Gil Sousa
uncommented, restarted service and error continues.
– Fabricio
You’ll have to restart your server, since PHP may have been installed as a server environment variable, not just Apache/IIS
– Not The Real Hemingway