mercredi 21 janvier 2015

SQLite3 Constructor create database Error - PHP

I want to implement a Language function into my Website. Im planning to do so with a simple SQLite Database System.


So far I got this Code:



private function openLanguagePack($package){
if(!file_exists($this->getLanguagePackUrl($package))){
$create = true;
}
$this->languagePacks[$package] = new SQLite3($this->getLanguagePackUrl($package));
if($create){
$this->languagePacks[$package]->queryExec('CREATE TABLE language (token nvarchar(50), text nvarchar(4000), PRIMARY KEY (token));');
}
}


(The Code comes from an old Project and used an Older Version of SQLite. Im rewriting it to SQLite3 now.


BUt with this code Im getting following Error:



Fatal error: Uncaught exception 'Exception' with message 'Unable to open database: unable to open database file'



I cann't see the Error. In the Documentation on PHP.net about the Constructor it says that ist automaticly creates a new database if there doesn't exist one. (At the moment the database doesn't exist.)


Does somebody know about that issue?


Aucun commentaire:

Enregistrer un commentaire