ID:               34868
 Updated by:       [EMAIL PROTECTED]
 Reported By:      Bjorn dot Wiberg at its dot uu dot se
-Status:           Open
+Status:           Feedback
 Bug Type:         SQLite related
 Operating System: AIX 5.2 ML5
 PHP Version:      5.0.5
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


>"read" (directory listing)
So is it "r" (read) or "x" (directory listing)? Or both?


Previous Comments:
------------------------------------------------------------------------

[2005-10-14 10:15:47] Bjorn dot Wiberg at its dot uu dot se

Description:
------------
If the path to the database to be created or opened does not have
"read" (directory listing) rights all the way, sqlite_open() fails.

Presumably because of getcwd() usage.


If one specifies the full path to the database file to be opened or
created, everything appears to work just fine.

Similarly, if one makes sure that "read" rights are present all the
way, everything appears to work just fine as well.


I do not know if this is specific to PHP+sqlite or to SQLite itself.

I'm using the bundled SQLite (automatically detected during
./configure).

Reproduce code:
---------------
<?php
  if ($db = sqlite_open('mysqlitedb', 0666, $sqliteerror)) {
  //if ($db = sqlite_open('./mysqlitedb', 0666, $sqliteerror)) {
  //if ($db = sqlite_open(dirname(__FILE__) . '/mysqlitedb', 0666,
$sqliteerror)) {
     sqlite_query($db, 'CREATE TABLE foo (bar varchar(10))');
     sqlite_query($db, "INSERT INTO foo VALUES ('fnord')");
     $result = sqlite_query($db, 'select bar from foo');
     var_dump(sqlite_fetch_array($result));
  } else {
    die($sqliteerror);
  }
?>


Expected result:
----------------
Successful creation of the database in all cases:

array(2) { [0]=>  string(5) "fnord" ["bar"]=>  string(5) "fnord" }


Actual result:
--------------
CASE 1 (open "mysqldb"):

Warning: sqlite_open(): unable to open database: mysqlitedb in
/apache/htdocs/bwiberg/test/sqlite/sqlite.php on line 2 unable to open
database: mysqlitedb

CASE 2 (open "./mysqldb"):

Warning: sqlite_open(): unable to open database: ./mysqlitedb in
/apache/htdocs/bwiberg/test/sqlite/sqlite.php on line 3 unable to open
database: ./mysqlitedb

CASE 3 (open with full path):

array(2) { [0]=>  string(5) "fnord" ["bar"]=>  string(5) "fnord" } 



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=34868&edit=1

Reply via email to