Trying to get a simple PHP/Zend Framework setup to create a SQLite databse and manipulate it.
<?php
require_once("Zend/Db.php"); // Zend framework
$db = Zend_Db::factory('Pdo_Sqlite', array("dbname" => "./test.sqlite3"));
$sql = "CREATE TABLE IF NOT EXISTS ".$db->quoteIdentifier("configs")." (".$db->quoteIdentifier("name")." TEXT NOT NULL PRIMARY KEY, ".$db->quoteIdentifier("value")." TEXT NOT NULL);";
echo $sql;
$db->query($sql);
The SQL echoes out as "CREATE TABLE IF NOT EXISTS "configs" ("name" TEXT NOT NULL PRIMARY KEY, "value" TEXT NOT NULL);
", which looks right.
But I get a 'Zend_Db_Statement_Exception
' with message 'SQLSTATE[HY000]: General error: 14 unable to open database file'. I've tried taking off the leading "./" on the "dbname
" variable, and ensured that the folder the PHP file is in has write permissions for everyone. I even tried creating the file with "touch test.sqlite3
" and ensured it was writable by everyone.
This is using PHP v5.2.10