Discuss [SQLite] and the iPhones own DB's (PiSA) at the Free Toolchain Software - Hackint0sh.org; I have succesfully installed Apache and PHP on the iPhone.
And the SQLite works as ...
-
[SQLite] and the iPhones own DB's (PiSA)
I have succesfully installed Apache and PHP on the iPhone.
And the SQLite works as well.
I can e.g. create a SQLite database.
But I can't read the DB's that the iPhone creates.
I have copied (just to make sure) the call_history.db database file to my own directory and chmod 666 (read and write).
But when I try to connect to the DB doesn't work
Warning: sqlite_open() [function.sqlite-open]: file is encrypted or is not a database in /Library/WebServer/Documents/callhist/index.php on line 4
My callhist.php is still fairly simple (to say the least):
<?
$db = sqlite_open( "/Library/WebServer/Documents/callhistory/call_history.db");
$query = "SELECT * FROM call";
$res = sqlite_query( $db, $query );
$row = sqlite_fetch_row($res);
echo $row['address'];
sqlite_close( $db );
?>
-
-
Owner
Who is PHP running as? I'll bet it's not the same as the person who owns call_history.db. Try a chown of call_history.db to the same user as PHP. (Make sure you do it to your copy not the original!)
-
-

Originally Posted by
meslater
Who is PHP running as? I'll bet it's not the same as the person who owns call_history.db. Try a chown of call_history.db to the same user as PHP. (Make sure you do it to your copy not the original!)
When I have CHMODed the file (666) everyone can read.
But my Apache/PHP runs as nobody. I have tried CHOWN the db file to nobody, - but that didn't change anything.
The php file is by the way still owned by root (and that reads fine)
-rw-rw-rw- 1 nobody admin 12288 Mar 9 00:48 call_history.db
-rw-r--r-- 1 root admin 252 Mar 9 01:17 index.php
-
Senior Professional
Array
Are you sure, that the database you created is compatible with the sqlite version php is linked with? The "file is encrypted or is not a database" happens if you try to open a sqlite3 database with sqlite2 (php is still linked with the old version).
-
-

Originally Posted by
mikrohard
Are you sure, that the database you created is compatible with the sqlite version php is linked with? The "file is encrypted or is not a database" happens if you try to open a sqlite3 database with sqlite2 (php is still linked with the old version).
Of course thats it (I didn't know, - thank you).
But how do I link PHP with sqlite3? I can see sqlite3 is in Cydia. But just installing it isn't enough, is it?
Last edited by DaDane; 03-11-2008 at 01:56 AM.
-
As mikrohard said, it doesn't work with sqlite3 directly from PHP, so you have to use exec() to get it to work.
First install sqlite3 in cydia, then try this:
<?php
exec('sqlite3 /Library/WebServer/Documents/callhistory/call_history.db "SELECT address FROM call"',$result);
foreach ($result as $v)
{
echo $v . '<br />';
}
?>
I didn't test it, but I think it should work. You might need to chmod some stuff to 755, not sure.
-
Similar Threads
-
By mentor667 in forum iPhone Developer Exchange
Replies: 12
Last Post: 11-28-2011, 09:39 PM
-
By sjurmr in forum iPhone Developer Exchange
Replies: 1
Last Post: 12-11-2008, 11:55 AM
-
By ugene in forum Free Toolchain Software
Replies: 0
Last Post: 10-24-2007, 06:23 AM
-
By fabiopigi in forum Free Toolchain Software
Replies: 0
Last Post: 10-13-2007, 11:52 AM
-
By RVN84 in forum Free Toolchain Software
Replies: 0
Last Post: 08-22-2007, 11:26 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks