PHP with Zend Framework can't start a SQLite database? -
Trying to get a simple PHP / Zend Framework setup to create and manipulate a SQLite databse.
& lt ;? Php require_once ("Zend / Db.php"); // Zend Framework $ db = Zend_Db :: Factory ('Pdo_Sqlite', array ("dbname" = & gt; "./test.sqlite3")); $ Sql = "If the table does not exist then" create tab ". $ Db- & quot; quoteIdentifier (" configs ")." (". $ Db-> quoteIdentifier (" name ")." Text tap primary key, "$ db -> Quotation marker (" value ")." Text not faucet); "; $ sql; $ per second DB-> Query ($ SQL);
In the form of SQL "Exchange does not make" the configuration when creating "(" name "text null is not the primary key) , Tap "value" text); ", which looks correct.
But I get ' Zend_Db_Statement_Exception
' with the 'SQLSTATE [HY000]' message: General Error: 14 Open the database file I have tried to move "pioneer on the variable" ./ "I have been unable to write", and have ensured that the PHP file is allowed to be written for everyone. " Tried to create a file with "test test.sqlite3
" and made sure that it is writeable by everyone
this PH P v5.2.10
Your code is working here (but Windows). Therefore the Some thoughts: array ("dbname" => is not a syntax problem)
strace
your script ( strace php test.php
) and for output errors Check it out. ./ test.sqlite3
is being created, it should be readable by the user running PHP and writable. This is enough for a readable and writable test.sqlite3
, because sqlite also writes a temporary test.sqlite3-journal
and writes that this directory should ensure that it is. pdo
and pdo_sqlite
extensions are loaded (check the output of phpinfo ())
). Also see that there is no conflict between system and php bundled SQLite labs.
Comments
Post a Comment