LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-07-2008, 07:54 AM   #1
brokenpromises
Member
 
Registered: Jan 2005
Location: NZ
Distribution: Fedora / Debian
Posts: 99

Rep: Reputation: 21
SQlite problems: attempt to write a readonly database


Hello,

I was running TorrentFlux with apache and mysql, but this was eating up far too many resoruces, so I decided to migrate to lighttpd and sSQlite. I managed to get lighttpd working pretty well (with php etc), but sqlite is another story.

After installing TorrentFlux, I went to log in as admin/admin for testing, I got this:

Code:
Debug SQL is on. 

SQL: INSERT INTO tf_users ( USER_ID, PASSWORD, HITS, LAST_VISIT, TIME_CREATED, USER_LEVEL, HIDE_OFFLINE, THEME, LANGUAGE_FILE ) VALUES ( 'admin', '21232f297a57a5a743894a0e4a801fc3', 1, '1199713815', '1199713815', 2, 0, 'matrix', 'lang-english.php' )


 Database error: attempt to write a readonly database

Always check your database variables in the config.php file.
I have checked my config.php numerous times and verified that its indeed set up correctly.

What do I have to do in SQlite to make the database writable?

If I do "chmod 777" or "chown www-data" the database in question, it says this:

Code:
 Debug SQL is on. 

SQL:INSERT INTO tf_users ( USER_ID, PASSWORD, HITS, LAST_VISIT, TIME_CREATED, USER_LEVEL, HIDE_OFFLINE, THEME, LANGUAGE_FILE ) VALUES ( 'admin', '21232f297a57a5a743894a0e4a801fc3', 1, '1199714023', '1199714023', 2, 0, 'matrix', 'lang-english.php' )


 Database error: unable to open database file

Always check your database variables in the config.php file.
Any help appreciated! I just can't seem to figure this one out!
 
Old 01-07-2008, 07:57 AM   #2
brokenpromises
Member
 
Registered: Jan 2005
Location: NZ
Distribution: Fedora / Debian
Posts: 99

Original Poster
Rep: Reputation: 21
Problem fixed. I have been beating my head against the wall. My problem was this:

My database (tflux.db) was located at /DBz/tflux.db

and /DBz/ was owned by root.

To fix this, I did this:

Code:
chown www-data /DBz/
and

Code:
chown www-data /DBz/tflux.db
And wham it logs straight in.
 
Old 03-04-2010, 03:24 AM   #3
namerohit
LQ Newbie
 
Registered: Mar 2010
Posts: 1

Rep: Reputation: 0
This worked for me also.

Also, for an absolute newbie like me, I tried the above solution, only thought that I had to replace www-data with my user, my like root (I am working on personal laptop). I assumed this coz I didn't knew that www-data is also a valid user in linux, which is created for alll web servers.
And changing to root did not work.

Only after banging my head across many forums, I came to know about www-data and then I tried this fix with the given user www-data and then it worked.

Hope this helps.


Quote:
Originally Posted by brokenpromises View Post
Problem fixed. I have been beating my head against the wall. My problem was this

My database (tflux.db) was located at /DBz/tflux.db

and /DBz/ was owned by root.

To fix this, I did this:

Code:
chown www-data /DBz/
and

Code:
chown www-data /DBz/tflux.db
And wham it logs straight in.
 
Old 09-10-2013, 10:52 AM   #4
Garrett85
Member
 
Registered: Jan 2011
Posts: 278

Rep: Reputation: 5
www-data

I was getting the same error. Now that I've chagned the owner to www-data I'm getting a new error:

-> [Tue Sep 10 10:42:46 2013] [error] [client 127.0.0.1] PHP Warning: SQLite3::exec(): unable to open database file in /var/www/ET/insert.php on line 21, referer: http://localhost/ET/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sqlite Database image malformed ravindranvasudevan Programming 6 08-10-2009 03:37 AM
External hard-drive - readonly, can't make it read/write mooseman Linux - Hardware 3 05-18-2007 02:27 AM
OS hangs on write attempt to DDS-2 changer dguy Linux - Software 7 02-23-2006 05:25 AM
SQLite database security - doesn't exist? vharishankar Linux - Security 2 11-30-2005 08:40 PM
SQLite database backup ddpicard Linux - Software 2 11-01-2004 06:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration