Discuss [SQLite] and the iPhones own DB's (PiSA) at the Free Toolchain Software (Cydia App's) - 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
My callhist.php is still fairly simple (to say the least):
Warning: sqlite_open() [function.sqlite-open]: file is encrypted or is not a database in /Library/WebServer/Documents/callhist/index.php on line 4
$db = sqlite_open( "/Library/WebServer/Documents/callhistory/call_history.db");
$query = "SELECT * FROM call";
$res = sqlite_query( $db, $query );
$row = sqlite_fetch_row($res);
sqlite_close( $db );
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.
Originally Posted by meslater
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
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).
Originally Posted by mikrohard
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:
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.
By mentor667 in forum iPhone Developer Exchange
Last Post: 11-28-2011, 09:39 PM
By sjurmr in forum iPhone Developer Exchange
Last Post: 12-11-2008, 11:55 AM
By ugene in forum Free Toolchain Software (Cydia App's)
Last Post: 10-24-2007, 07:23 AM
By fabiopigi in forum Free Toolchain Software (Cydia App's)
Last Post: 10-13-2007, 12:52 PM
By RVN84 in forum Free Toolchain Software (Cydia App's)
Last Post: 08-23-2007, 12:26 AM