Database Exception (yii\db\Exception)
SQLSTATE[HY000]: General error: 14 unable to open database file
But, the db is readable and writable! (777)
Source can be found here:
https://github.com/philippfrenzel/frenzelgmbh/blob/master/app/controllers/MessagesController.php
Just get your sources. And create messages. All works ok. So i think problem on your server.
Hi, thank you very much for the debugging, so I have to figure out, what's
wrong with my system Å Should I post the reason?
Von: rusmaxim [email protected]
Antworten an: yiisoft/yii2
Datum: Samstag, 11. Mai 2013 12:14
An: yiisoft/yii2 [email protected]
Cc: Philipp Frenzel [email protected]
Betreff: Re: [yii2] sqlite error while inserting new record (#232)
Just get your sources. And create messages. All works ok. So i think problem
on your server.
‹
Reply to this email directly or view it on GitHub
https://github.com/yiisoft/yii2/issues/232#issuecomment-17757552 .
I think it may be useful
Is the directory containing your sqlite file writable?
Yes 777
Von meinem iPhone gesendet
Am 11.05.2013 um 14:01 schrieb Qiang Xue [email protected]:
Is the directory containing your sqlite file writable?
—
Reply to this email directly or view it on GitHub.
disk space problems? any special open_base_dir restrictions or other things active?
thanks for the many answers and suggestions! The think is, that on my external webserver it works, but on my local machine it fails:( with yii 1.11 I have no problems!
The owner of the db-file is: staff
For complete enviroment here the log enty while I try to insert:
2013/05/11 18:55:17 [::1] [error] [yii\db\Command::execute] SQLSTATE[HY000]: General error: 14 unable to open database file
Failed to execute SQL: INSERT INTO 'tbl_messages' ("reciever_id", "subject", "is_read", "creation_date", "sender_id") VALUES ('1', 'Test Test', '', '2013-05-11 18:55:17', '1')
2013/05/11 18:55:17 [::1] [error] [yii\db\Exception] exception 'yii\db\Exception' with message 'SQLSTATE[HY000]: General error: 14 unable to open database file' in /Users/philippfrenzel/Sites/pliq/frenzelgmbh/yii/vendor/yiisoft/yii2/yii/db/Command.php:307
Stack trace:
2013/05/11 18:55:17 [::1] [info] [application] $_GET = array (
'r' => 'messages/create',
)
$_POST = array (
'Messages' =>
array (
'reciever_id' => '1',
'subject' => 'Test Test',
'body' => 'Test Test ',
'is_read' => '',
),
)
$_COOKIE = array (
'__utma' => '111872281.460877435.1358881031.1358881031.1358881031.1',
'__utmz' => '111872281.1358881031.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)',
'PHPSESSID' => 'ddc935af191ef64db8c1106d72c48537',
)
$_SESSION = array (
'220a2205bf41869e8c5fdda55bb5a55d__id' => '2',
'220a2205bf41869e8c5fdda55bb5a55d__name' => 'admin',
'220a2205bf41869e8c5fdda55bb5a55drole' => '1',
'220a2205bf41869e8c5fdda55bb5a55d__states' =>
array (
'role' => true,
),
'search' => '',
'lists' =>
array (
0 => '9',
),
'country' => '',
'__flash' =>
array (
),
'__id' => '1',
'__captcha/site/captcha' => 'toxine',
'__captcha/site/captchacount' => 1,
)
$_SERVER = array (
'UNIQUE_ID' => 'UY539cCoAAsAAU2jNpQAAAAH',
'HTTP_HOST' => 'localhost:8081',
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:20.0) Gecko/20100101 Firefox/20.0',
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,_/_;q=0.8',
'HTTP_ACCEPT_LANGUAGE' => 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3',
'HTTP_ACCEPT_ENCODING' => 'gzip, deflate',
'HTTP_REFERER' => 'http://localhost:8081/frenzelgmbh/web/index.php?r=messages/create',
'HTTP_COOKIE' => '__utma=111872281.460877435.1358881031.1358881031.1358881031.1; __utmz=111872281.1358881031.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); PHPSESSID=ddc935af191ef64db8c1106d72c48537',
'HTTP_CONNECTION' => 'keep-alive',
'CONTENT_TYPE' => 'application/x-www-form-urlencoded',
'CONTENT_LENGTH' => '112',
'PATH' => '/usr/bin:/bin:/usr/sbin:/sbin',
'DYLD_LIBRARY_PATH' => '/Applications/XAMPP/xamppfiles/lib',
'SERVER_SIGNATURE' => '',
'SERVER_SOFTWARE' => 'Apache/2.4.3 (Unix) OpenSSL/1.0.1c PHP/5.4.7',
'SERVER_NAME' => 'localhost',
'SERVER_ADDR' => '::1',
'SERVER_PORT' => '8081',
'REMOTE_ADDR' => '::1',
'DOCUMENT_ROOT' => '/Users/philippfrenzel/Sites/pliq',
'REQUEST_SCHEME' => 'http',
'CONTEXT_PREFIX' => '',
'CONTEXT_DOCUMENT_ROOT' => '/Users/philippfrenzel/Sites/pliq',
'SERVER_ADMIN' => '[email protected]',
'SCRIPT_FILENAME' => '/Users/philippfrenzel/Sites/pliq/frenzelgmbh/web/index.php',
'REMOTE_PORT' => '59558',
'GATEWAY_INTERFACE' => 'CGI/1.1',
'SERVER_PROTOCOL' => 'HTTP/1.1',
'REQUEST_METHOD' => 'POST',
'QUERY_STRING' => 'r=messages/create',
'REQUEST_URI' => '/frenzelgmbh/web/index.php?r=messages/create',
'SCRIPT_NAME' => '/frenzelgmbh/web/index.php',
'PHP_SELF' => '/frenzelgmbh/web/index.php',
'REQUEST_TIME_FLOAT' => 1368291317.51,
'REQUEST_TIME' => 1368291317,
'argv' =>
array (
0 => 'r=messages/create',
),
'argc' => 1,
)
ok, finaly found another possible reason...
inside the textarea, i have a "wrong" id:
textarea id="messages-body" rows="10" name="Messages[body]"
So it works now? After you changed a text areas id?
Ok, I'm still in "search" mode! And it's not the textareas id -> and although not the database access! I can easily read and write with other components...
I created a simple console controller thanks to @cebe ! and with this it's easy to create users or messages
complete project can be found in the repo and running sample is online under www.frenzel.net ...
I will dig into the blog2.0 from @netyum to see how he is writing (mysql) but should be the same?!
I close it, as it works online without any problems... can't figure out the local problem:( but must be a fault of my configuration... if you don't agree, pls. reopen;)
I had this problem too. You must set mode 777 on directory which contains sqlite database, and all will work.
don't recommend chmod 777 ...
recommending changing the owner to the web server user, and restricting access to anybody else would be appropriate.
chown -R <www-userorwhateveritiscalled> folder
chmod -R go-rwx folder
chmod -R u+rwX folder
gives you
drwx------
on the folder
and
-rw-------
on the database.
@elyzov THX a lotttttttt!!!!!!!!! That costs me lots of time to find the answer
Most helpful comment
I had this problem too. You must set mode 777 on directory which contains sqlite database, and all will work.