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 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 =” in /etc/php5/apache2/conf.d/, then restart your web server.

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on TumblrEmail this to someone


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

  2. 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.

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

    ../../../../php/php5/ error: invalid conversion from ‘const char*’ to ‘char*’
    make[5]: *** [xapian_wrap.lo] Error 1

    Any ideas?

Leave a Reply

Your email address will not be published. Required fields are marked *