From: [EMAIL PROTECTED]
Operating system: Linux
PHP version: 6CVS-2005-10-01 (CVS)
PHP Bug Type: PDO related
Bug description: PDO's sqlite driver unable to write to database
Description:
------------
In PHP6, PDO seems unable to write to a sqlite database.
However, just to make it interesting, it's only a problem when the script
is executed by the webserver (in my case apache).
Initially I thought it was a permissions issue, but the database file was
666.
Running the script from CLI worked as expected, running it from the
webserver produced the error:
Warning: PDO::query() [function.query]: SQLSTATE[HY000]: General error: 1
unable to open database file
Confusing, because the database file is already open as demonstrated by
the successful query of the same table in the previous line.
Reproduce code:
---------------
<?php
$db = new PDO('sqlite:repository.db');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$res = $db->query('SELECT visits from pages where id=1');
$tml = $res->fetchAll();
echo $tml[0][0], "\n";
$db->query('UPDATE pages SET visits = visits+1 WHERE id =1');
Expected result:
----------------
23324
Actual result:
--------------
23324
Warning: PDO::query() [function.query]: SQLSTATE[HY000]: General error: 1
unable to open database file in
/home/aidan/public_html/repos/database/test.php on line 10
--
Edit bug report at http://bugs.php.net/?id=34699&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34699&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34699&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34699&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34699&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34699&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34699&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34699&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34699&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34699&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34699&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34699&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34699&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34699&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34699&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34699&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34699&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34699&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34699&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34699&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34699&r=mysqlcfg