macsat.com OpenWrt and ASUS WL Forum
January 08, 2009, 19:16:33 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?
Login with username, password and session length
News: Back to macsat.com
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: php-thttp+sqlite: malformed database schema- unable to open a temporary database  (Read 4123 times)
0 Members and 1 Guest are viewing this topic.
mistvan
Newbie
*
Offline Offline

Posts: 15


View Profile
« on: July 08, 2007, 15:26:34 PM »

Hi!

I got the following error accessing my sqlite file with php:
"malformed database schema - unable to open a temporary database file for storing temporary tables".
To which directory or file does it try to write?

Thanks in advance for your help:
Istvan
Logged
macsat
Administrator
Sr. Member
*****
Offline Offline

Posts: 1,104



View Profile
« Reply #1 on: July 09, 2007, 10:55:26 AM »


It seems like sqlite is trying to write a tmp-table file in the directory in which the databasefile resides. Try (at least as a test) to give world write rights to the directory.

If you have the database file in /opt/www/db then :
Code:
chmod 777 -R /opt/www/db

This isn't very good security - but try it, just to test if this is indeed the problem :-)
Logged
mistvan
Newbie
*
Offline Offline

Posts: 15


View Profile
« Reply #2 on: July 09, 2007, 14:42:18 PM »

Thanks for your reply.

I did what you suggested (chmod -R 777 /opt/share/sqlite/):

drwxrwxrwx    2 root     root         4096 Jul  8 03:02 sqlite

I modified even my file:
-rwxrwxrwx    1 root     root         3072 Jul  8 03:02 test.db

But nothing changed:

Warning: sqlite_open() [function.sqlite-open]: malformed database schema - unable to open a temporary database file for storing temporary tables in /opt/share/www/sqlite.php on line 2
« Last Edit: July 09, 2007, 14:44:19 PM by mistvan » Logged
mistvan
Newbie
*
Offline Offline

Posts: 15


View Profile
« Reply #3 on: July 17, 2007, 03:01:43 AM »

Nobody can help me?  Huh
Logged
macsat
Administrator
Sr. Member
*****
Offline Offline

Posts: 1,104



View Profile
« Reply #4 on: July 17, 2007, 06:46:26 AM »


How did you create the sqlite file?

Did you test it from the console if it works?

Logged
mistvan
Newbie
*
Offline Offline

Posts: 15


View Profile
« Reply #5 on: July 17, 2007, 22:29:53 PM »

Yes, I created it from the console and it worked fine (create table, insert, select, etc.).
I even tried to create the file and table from the php code, but it terminated with the same error.
I think the key to this problem is to know where it tries to create the temporary directory/file.
Do you know where is the temp dir of thttp itself?
Logged
macsat
Administrator
Sr. Member
*****
Offline Offline

Posts: 1,104



View Profile
« Reply #6 on: July 18, 2007, 07:36:48 AM »


You are using thttpd?

This COULD be the reason. I thought you where using lighttpd.

I've never tested PHP5 + SQLite in thttpd.

My guess is that it uses /tmp - but this is just a guess.
Logged
mistvan
Newbie
*
Offline Offline

Posts: 15


View Profile
« Reply #7 on: July 18, 2007, 22:08:30 PM »

I found a solution. I think it's quite risky, but it works.
I changed user=nobody to user=admin in thttpd.conf.
« Last Edit: July 18, 2007, 22:53:29 PM by mistvan » Logged
macsat
Administrator
Sr. Member
*****
Offline Offline

Posts: 1,104



View Profile
« Reply #8 on: July 19, 2007, 06:51:06 AM »


Sounds a bit risky, yes :-)

Instead, you could try to :
Code:
chown nobody /opt/share/sqlite/
chown nobody /opt/share/sqlite/test.db
Logged
mistvan
Newbie
*
Offline Offline

Posts: 15


View Profile
« Reply #9 on: July 22, 2007, 17:04:45 PM »

No, unfortunately it's not working with chmod... Embarrassed
Logged
macsat
Administrator
Sr. Member
*****
Offline Offline

Posts: 1,104



View Profile
« Reply #10 on: July 23, 2007, 07:54:10 AM »


Sounds strange.

Unfortunately I dont have a router running Olegs firwmare here, so I cant even check it out for you.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

English Steel 1.6 © Saxon North Technologies
Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Page created in 0.19 seconds with 23 queries.