Hi all,
I have ubuntu and just installed sqlite then edit the php.ini file accordingly but for some reason the class named ¨SQLiteDatabase()¨ reports as undefined. The error is as follows:

Fatal error: Uncaught exception 'SQLiteException' with message 'SQLiteDatabase::__construct() [<a href='sqlitedatabase.--construct'>sqlitedatabase.--construct</a>]: unable to open database: /var/www/vhosts/cwarn23/base' in /var/www/vhosts/cwarn23/php.php:3 Stack trace: #0 /var/www/vhosts/cwarn23/php.php(3): SQLiteDatabase->__construct('base', 438, 'unable to open ...') #1 {main} thrown in /var/www/vhosts/cwarn23/php.php on line 3

And my script is

<?php
$dbname='base';
$base=new SQLiteDatabase($dbname, 0666, $err);
if ($err)
{ 
  echo "SQLite NOT supported.\n";
  exit($err);
}
else
{
  echo "SQLite supported.\n";
}

So does anyone know what would make sqlite behave in such a way? Also the tutorial I was following is at http://www.scriptol.com/sql/sqlite-getting-started.php
And yes I tried restarting apache after making changes to php.ini

Recommended Answers

All 4 Replies

Member Avatar for nileshgr

Do you have write permissions to the directory ?

commented: Great life saving post in speedy time(); +5

Thank you times 1 million. Couldn't work out why every tutorial didn't work and of course the permissions. Glad to see somebody can always help even the most experienced.
Thanks ^_^

Member Avatar for nileshgr

Thank you times 1 million. Couldn't work out why every tutorial didn't work and of course the permissions. Glad to see somebody can always help even the most experienced.
Thanks ^_^

Hehe. If the problem is solved then mark the thread as solved, so nobody else wastes his effort to debug your problem ;)

I forgot about the how solved threads add to the stats. And yea I was going to leave it open for if I had more questions. I guess I'll just open another topic if I have more questions. Anyways *solved*

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.