[Xapian-discuss] PHP Bindings

Olly Betts olly at survex.com
Wed Sep 8 14:54:38 BST 2004


On Wed, Sep 08, 2004 at 02:14:46PM +0100, James Aylett wrote:
> On Wed, Sep 08, 2004 at 02:00:36PM +0100, Olly Betts wrote:
> 
> > > I think the examples should assume the invocation will load the .so,
> > > personally.
> > 
> > OK, but we should document how to make sure it's loaded then, otherwise
> > users face a potential frustration trying to get even the examples to
> > run.
> > 
> > Alternatively, we could try to load the extension if it's not already
> > loaded.
> 
> Yes, but that means you have this code at the top of the examples which
> is confusing :-(

Not being able to work out how to run the script is more confusing - I
had to consult Google to work out how to run them so I speak from
experience.

> Documenting it would be fine, I think. Anyone else?

That's OK with me too.

> > I'm planning to add an automated "smoke test" to each bindings too, so
> > "make check" will run a simple script for each which at least ensures
> > that the extension can be loaded and (say) stemming a word works.
> 
> Could we have a slightly bigger one that tests the core Xapian
> functionality through InMemory?

Yes, but I don't really have the time to mess with this - I've a lot
of core library stuff I want to sort out.

The gain from having a test which shows the extension loads and can be
called is substantial and the effort is small.  More extensive tests
would be useful - ideally we'd check that as many methods of as many
classes as possible can be called and give sane results.  I'll leave
that as a project for someone else.

> > I think we also want two modes of installation - currently we carefully
> > try to detect the standard directories to install stuff into for each
> > language.  However if you're not root, this means you need to install
> > your own copy of the interpreter, mess with libtool's abstraction and
> > poke around in .libs, or mess with DESTDIR when installing.  If you
> > could force everything to be installed under --prefix, then most
> > languages allow you to load extensions from non-standard locations,
> > and ideally we want to document the required runes ("make check" will
> > need to use them too).
> 
> We discussed a while ago having something like --python-lib-dir or
> something, to override Python's built-in system path (and other
> languages similarly).
> 
> Python you set PYTHONPATH.
> PHP you need to do one of two things (first will be best for make
> check):
> 
>  * php -d extension=/full/path/to/xapian.so (or in php.ini)
>  * php.ini contains extension_dir appropriately; php -d
>  extension=xapian.so (or in php.ini)

Or you can use dl() of course...

> [is_empty() vs empty() in bindings]
> 
> I vote for changing them all to empty() /
> XapianWhatever_empty(). (It's possible that plain empty() in PHP could
> have caused problems sometimes? Doesn't matter with prefixing.)

OK, I'll do that.  Do we want to keep the is_empty() forms around for a
while, or do we still consider the bindings to be sufficiently under
development that we can rename a method provided we advertise it clearly
in the NEWS file?

Cheers,
    Olly



More information about the Xapian-discuss mailing list