HOWTO Build your own binaries of PHP Xapian bindings for Debian

Due to a licensing issue, the PHP bindings for Xapian were removed from Debian Squeeze. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513796 for more information about this. Though, it is not really hard to build your own package from source. Here is how:
sudo apt-get build-dep xapian-bindings
sudo apt-get install php5-dev php5-cli
apt-get source xapian-bindings
cd xapian-bindings-1.2.*
rm debian/control
env PHP_VERSIONS=5 debian/rules maint
debuild -e PHP_VERSIONS=5 -us -uc
cd ..
sudo dpkg -i php5-xapian_*.deb
Be careful: the extracted source directory (xapian-bindings-1.2.*) has to be absolutely clean, so if you tried a first time and it failed, remove the whole directory before trying again. Of course, the same procedure holds true for Ubuntu as well. 2012-12-23 edit: if you're using PHP 5.4, you need to modify the debuild line. Check the update article on Xapian's wiki To enable the extension, don't forget to create a xapian.ini  (or 20-xapian.ini for the latest Ubuntu with PHP 5.4) containing "extension = xapian.so" in /etc/php5/apache2/conf.d/, then restart your web server.

Comments

I had an issue that the "debuild" command was not found on my Debian Squeeze installation. Solution: apt-get install devscripts

The Xapian documentation has an FAQ on this which contains the devscripts requirements. There's a current problem at least with Ubuntu because of a VPATH build issue; hopefully we'll have a decent fix soon and will update the FAQ accordingly.

Als antwoord op door YW

Permalink

Indeed. I'll ask Jérôme to have a look, he's the man for that.

Nevermind, also working in actual Debian Squeeze.
As mentioned, you have to copy 1 file (xapian.php) 1 folder deeper, so that the include can find the file and goes on well :-)

Als antwoord op door YW

Permalink

ok, thanks

I have problems compiling the bindings for php under debian squeeze and php 5.4.
The debuild command fails with an error:

[quote]
../../../../php/php5/xapian_wrap.cc:894: error: invalid conversion from 'const char*' to 'char*'
make[5]: *** [xapian_wrap.lo] Error 1
[/quote]

Any ideas?