Re: [sqlite] Problems with SQLite and PHP

2007-10-08 Thread Trevor Talbot
On 10/8/07, Markus Wolff - NorthClick <[EMAIL PROTECTED]> wrote:

> I find this to be a bit irritating - shouldn't it be enough that the
> server can dive into that subdir and find a file it can actually write
> to within the dir? How does it make sense that the entire directory
> containing the directory must be writeable? Is this an SQLite
> requirement or a PHP quirk?

SQLite needs to be able to create and delete a journal file during
database modification.

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Problems with SQLite and PHP

2007-10-08 Thread Andy Goth
On Mon, 08 Oct 2007 13:12:08 +0200, Markus Wolff - NorthClick wrote
> How does it make sense that the entire directory containing the 
> directory must be writeable?

Sounds like a temporary file or lock file is being created.

Somebody who knows more about PHP or SQLite can tell you which is taking
place.  Me, I'd find out what's really happening by running SQLite in strace
and looking for open() calls.

-- 
Andy Goth
<[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Problems with SQLite and PHP

2007-10-08 Thread Markus Wolff - NorthClick
I have found the problem. PHP was happily reporting that the frontend.db
file itself is writeable (which was true all the time), but the
directory containing the database was not writeable by the webserver.

I find this to be a bit irritating - shouldn't it be enough that the
server can dive into that subdir and find a file it can actually write
to within the dir? How does it make sense that the entire directory
containing the directory must be writeable? Is this an SQLite
requirement or a PHP quirk?

This way I will have to make a new directory exclusively for the
database, because I do not want all scripts to have write access to the
whole main dir...

CU
 Markus

Am Donnerstag, den 04.10.2007, 23:37 +0200 schrieb Markus Wolff:
> Hello everone,
> 
> I'm having a really weird problem with SQLite when used with PHP - I'm 
> pretty sure it's not SQLite that's at fault here, but since in the 
> PHP-DB mailingliste nobody seemed to be able to help me, I'm hoping to 
> get some insights here :-)
> 
> 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.
> 
> 
> For the previous discussion in the PHP-DB mailinglist, see here 
> (starting point, same content as above):
> http://marc.info/?l=php-db=119134768316086=2
> 
> A detailed step-by-step list for reproducing the problem, including the 
> used SQL schema, can be found here:
> http://marc.info/?l=php-db=119143000125909=2
> 
> I hope someone here can point me in the right direction, I'm getting 
> somewhat desperate :-)
> 
> 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


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Problems with SQLite and PHP

2007-10-08 Thread Markus Wolff - NorthClick
Am Freitag, den 05.10.2007, 01:03 +0200 schrieb Kees Nuyt:
> I can't reproduce the exception (the PDO->query
> version) on an environment I happened to have
> available.
> 
> - MS Windows XP Professional (5.2 build 2600)
> - Apache 2.2.4
> - PHP 5.2.2
> - PDO SQLite 1.0.1 2007/03/23
> - SQLite library 3.3.16
> 
> Perhaps I'll try again tomorrow with the
> same installation, but using
> - SQLite library 3.4.2
> 
> The only thing i can think of (wild guess) is your
> php-cli uses another php.ini than the Apache module does.

Hi Kees,

it's true that the php.ini is different for the CLI and mod_php variants
- that's actually quite a common setup.

The library version used by PHP seems to be consistent with the SQLite
commandline tool, though:

$ php -i | grep -i sqlite
/etc/php5/cli/conf.d/02_pdo_sqlite.ini,
/etc/php5/cli/conf.d/03_sqlite3.ini,
/etc/php5/cli/conf.d/04_sqlite.ini,
PDO drivers => sqlite, mysql
pdo_sqlite
PDO Driver for SQLite 3.x => enabled
PECL Module version => 1.0.1 $Id: pdo_sqlite.c,v 1.10.2.6 2006/01/01
12:50:12 sniper Exp $
SQLite Library => 3.4.2
SQLITE3
SQLite3 support => enabled
sqlite3 library version => 3.4.2

The phpinfo() output from mod_php states exactly the same version.

CU
 Markus


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Problems with SQLite and PHP

2007-10-08 Thread Markus Wolff - NorthClick
Hi Joe,

standard temp directory in my setup is /tmp, which is both readable and
writeable by Apache. Available space is 21GB, which should be more than
sufficient for the task at hand :-)

CU
 Markus

Am Donnerstag, den 04.10.2007, 16:13 -0700 schrieb Joe Wilson:
> See if the apache/mod_php process' unix account can read/write to at 
> least one of the following directories and there is sufficient disk 
> space in the first such directory that is r/w.
> 
>  pragma temp_store_directory;  -- if present. As run in apache.
>  /var/tmp
>  /usr/tmp
>  /tmp
>  .
> 
> --- Markus Wolff <[EMAIL PROTECTED]> wrote:
> > 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
> 
> 
>   
> 
> Shape Yahoo! in your own image.  Join our Network Research Panel today!   
> http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 
> 
> 
> 
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
> 
-- 
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


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Problems with SQLite and PHP

2007-10-04 Thread Joe Wilson
See if the apache/mod_php process' unix account can read/write to at 
least one of the following directories and there is sufficient disk 
space in the first such directory that is r/w.

 pragma temp_store_directory;  -- if present. As run in apache.
 /var/tmp
 /usr/tmp
 /tmp
 .

--- Markus Wolff <[EMAIL PROTECTED]> wrote:
> 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


  

Shape Yahoo! in your own image.  Join our Network Research Panel today!   
http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Problems with SQLite and PHP

2007-10-04 Thread Kees Nuyt

Hi Markus,

On Thu, 04 Oct 2007 23:37:33 +0200, you wrote:

>Hello everone,
>
>I'm having a really weird problem with SQLite when used with PHP - I'm 
>pretty sure it's not SQLite that's at fault here, but since in the 
>PHP-DB mailingliste nobody seemed to be able to help me, I'm hoping to 
>get some insights here :-)

[snip]

>For the previous discussion in the PHP-DB mailinglist, see here 
>(starting point, same content as above):
>http://marc.info/?l=php-db=119134768316086=2
>
>A detailed step-by-step list for reproducing the problem, including the 
>used SQL schema, can be found here:
>http://marc.info/?l=php-db=119143000125909=2
>
>I hope someone here can point me in the right direction, I'm getting 
>somewhat desperate :-)
>
>Thanks,
>Markus

I can't reproduce the exception (the PDO->query
version) on an environment I happened to have
available.

- MS Windows XP Professional (5.2 build 2600)
- Apache 2.2.4
- PHP 5.2.2
- PDO SQLite 1.0.1 2007/03/23
- SQLite library 3.3.16

Perhaps I'll try again tomorrow with the
same installation, but using
- SQLite library 3.4.2

The only thing i can think of (wild guess) is your
php-cli uses another php.ini than the Apache module does.

Good luck !
-- 
  (  Kees Nuyt
  )
c[_]

-
To unsubscribe, send email to [EMAIL PROTECTED]
-