Can't open SQLite DB... but only when using mod_php??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey there,

I'm trying to open an SQLite3 database from a PHP very simple PHP
script:

$db = dirname(__FILE__).'/frontend.db';
$pdo = new PDO('sqlite:'.$db);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->query("SELECT * FROM page LIMIT 1");
echo "Deleting pages\n";           
$pdo->query("DELETE FROM page");
echo "Deleting websites\n";
$pdo->query("DELETE FROM website");

The database file contains no data whatsoever, just the table
definitions (in case you were wondering, this is a stripped-down version
of a larger script for debugging purposes, hence the seemingly idiotic
DELETE statements that won't do any good in an empty database anyway,
but I digress...).

When executed on the command line, this works perfectly. When I execute
the same script via Apache and mod_php, I'm getting this exception:

PDOException: SQLSTATE[HY000]: General error: 1 SQL logic error or
missing database in /home/mwolff/webs/markus/cms/test.php on line 8

Getting experimental, I've tried to change the calls for the DELETE
statements from $pdo->query() to $pdo->exec(), just to see what happens.
Well, what happens is that I'm getting a different error:

PDOException: SQLSTATE[HY000]: General error: 14 unable to open database
file in /home/mwolff/webs/markus/cms/test.php on line 6

Argh... what can possibly be wrong here? The script works from the
commandline, with the exact same PHP version (Debian package, PHP
5.2.0-8+etch7, and we also tried upgrading to the latest Debian package
of 5.2.4, to no avail).

It can't be file permissions, I've even tried to set the database file
to 777... no change at all.

Does this ring a bell with anyone here?

Thanks,
 Markus

-- 
Mit freundlichen Grüßen
Markus Wolff
Development

NorthClick GmbH

Gasstr. 10 - 22761 Hamburg
Tel.: 040 8 22 44 999 - Fax: 040 8 22 44 998
Internet: http://www.northclick.de/

Geschäftsführer: F. Detzner | M. Henze | C. Springub
Amtsgericht Hamburg, HRB 94459

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux