Francis Irving
2007-May-23 00:28 UTC
[Xapian-discuss] Debian etch packages of php5-xapians have old style flat function interface
I'm running Debian stable (etch) on a server, and have the following Xapian packages installed. root@seagrass:/etc/php5/apache# dpkg -l | grep xap ii libxapian-dev 0.9.9-1 Development files for Xapian search engine l ii libxapian13 0.9.9-1 Search engine library ii php4-xapian 0.9.9-1.1 Xapian search engine interface for PHP4 ii php5-xapian 0.9.9-1.1 Xapian search engine interface for PHP5 ii python-xapian 0.9.9-1.1 Xapian search engine interface for Python ii xapian-doc 0.9.9-1 Core Xapian documentation ii xapian-examples 0.9.9-1 Xapian simple example programs ii xapian-tools 0.9.9-1 Basic tools for Xapian search engine library If I use PHP4, things are fine. When I use PHP5, I get "Class 'XapianDatabase' not found" errors. Upon closer inspection using phpinfo(), get_declared_classes() and get_defined_functions() I find that: 1) phpinfo says the Xapian module is loaded, version 0.9.9 2) The old style flat functions like new_database are there 3) The new style classes (XapianDatabase etc.) are not there 4) There are no functions or classes containing the text "xap" Running strings on the .so files for the PHP bindings /usr/lib/php4/20050606+lfs/xapian.so /usr/lib/php5/20060613+lfs/xapian.so confirms that the text XapianDatabase is only present in the PHP4 xapian.so. And using lsof confirms that Apache has loaded that php5 xapian.so file. So I'm stumped. Surely the PHP5 bindings should be in the new style OO interface to Xapian? I've hunted for other Debian packages of php5-xapian, but can't find any to try. Francis
Olly Betts
2007-May-23 08:14 UTC
[Xapian-discuss] Debian etch packages of php5-xapians have old style flat function interface
On Wed, May 23, 2007 at 12:28:40AM +0100, Francis Irving wrote:> 1) phpinfo says the Xapian module is loaded, version 0.9.9I'm hoping to sort of debian packages of 1.0.0 next week.> 2) The old style flat functions like new_database are thereThat is expected. In PHP4, the classes are implemented using calls to the zend API. But that technique apparently can't be used for PHP5 for some reason nobody has ever fully explained to me, so instead SWIG wraps the Xapian API as flat functions using calls to the zend API from a C++ wrapper, and then wraps those with class wrappers implemented in PHP.> 3) The new style classes (XapianDatabase etc.) are not thereI suspect you've not loaded the PHP class wrappers. I think this note in the documentation was added after 0.9.9: If you're using PHP5, you also need to add `include "xapian.php"' to your PHP scripts which use Xapian in order to get the PHP class wrappers. Cheers, Olly