From: Bjorn dot Wiberg at its dot uu dot se Operating system: AIX 5.2 ML5 PHP version: 5.0.5 PHP Bug Type: SQLite related Bug description: sqlite_open() fails if directory along path misses read flag
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 bug report at http://bugs.php.net/?id=34868&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34868&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34868&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34868&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34868&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34868&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34868&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34868&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34868&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34868&r=support Expected behavior: http://bugs.php.net/fix.php?id=34868&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34868&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34868&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34868&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34868&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34868&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34868&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34868&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34868&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34868&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34868&r=mysqlcfg