Answer the question
In order to leave comments, you need to log in
How to fix the error "Error: Class 'SQLite3' not found in /var/www/test.site/public_html/news/NewsDB.class.php on line 17"?
There is the following code
class NewsDB implements INewsDB{
const DB_NAME = __DIR__.'/news.db';
private $_db;
function __get($name) {
// TODO: Implement __get() method.
if($name == 'db'){
return $this->_db;
}
throw new Exception('Unknown property!!!');
}
function __construct() {
$this->_db = new SQLite3(self::DB_NAME);
}
function __destruct() {
// TODO: Implement __destruct() method.
unset($this->_db);
}
function saveNews($title, $category, $description, $source) {
// TODO: Implement saveNews() method.
}
function getNews() {
// TODO: Implement getNews() method.
}
function deleteNews($id) {
// TODO: Implement deleteNews() method.
}
}
$news = new NewsDB();
Fatal error: Uncaught Error: Class 'SQLite3' not found in /var/www/test.site/public_html/news/NewsDB.class.php on line 17
Answer the question
In order to leave comments, you need to log in
sudo apt-get install php7.0-sqlite3
To see files starting with a dot (hidden files) in the terminal, you need to type ls -a
PhpStorm sees such files by default
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question