[Xapian-discuss] PHP5 example don't understand

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

On Mon, Mar 19, 2007 at 01:20:13PM +0000, Olly Betts wrote:

> > Sounds also like you're trying to run simpleindex via a web server,
> > which is not how it's designed
> Indeed, but most people think "webserver" when they think "PHP" so this
> is an easy mistake to make and we should check for it and issue a
> helpful error message.

People think lots of things when they think 'PHP'; I actually doubt
that most PHP users think of web servers more than once or twice a
week. (Not a bad thing, just that it mostly works and you don't have
to think about it; we have developers who still forget that their
files are on a different machine to the shell, on a different machine
to the web server...)

> Is there an official way to check "is this PHP script running in a CLI
> version of PHP"?  I can't see one in the documentation, but it looks
> like checking $_SERVER['argc'] should work if there's no official way.

I can't find a way of directly finding out which SAPI you're running
under. Checking argc seems a reasonable approach to me.

A great big comment at the top of the example scripts might help, too.


  James Aylett                                                  xapian.org
  james at tartarus.org                               uncertaintydivision.org

More information about the Xapian-discuss mailing list