[Xapian-discuss] PHP5 example don't understand

James Aylett james-xapian at tartarus.org
Mon Mar 19 13:08:09 GMT 2007


On Mon, Mar 19, 2007 at 12:40:27PM +0000, iX Gamerz wrote:

> I have find something...
> I used the simpleIndex.php
> 
> I have declared this two value:
> 
> $_SERVER['argv'][0] = "/var/lib/omega/data/default";
> $_SERVER['argv'][1] = "/var/lib/omega/data/default";
> 
> This is the error message
> 
> Fatal error: Uncaught exception 'Exception' with message 
> 'DatabaseOpeningError: Cannot create directory 
> `/var/lib/omega/data/default'' in /var/www/xapian/xapian.php:1059 Stack 

Erm... sounds like it's trying to create a directory in a place you
don't have permissions for under the user you're running
simpleindex. Try changing argv[1] to "./testdb" or something (and
it'll then create in the directory local to wherever you're running it
[1].

Sounds also like you're trying to run simpleindex via a web server,
which is not how it's designed - it's intended for use from the
command line (via the CLI SAPI). You can modify it for use in the way
you're trying (which you effectively have done), but you have to put
much more thought into where directories live up front if you're
trying to learn Xapian this way, or you may run into security problems
when you try to deploy.

argv[0] is supposed to be the name of the script - it would be if you
ran simpleindex on the command line.

[1] in general the same directory as the script, if running under a
web server

J

-- 
/--------------------------------------------------------------------------\
  James Aylett                                                  xapian.org
  james at tartarus.org                               uncertaintydivision.org



More information about the Xapian-discuss mailing list