Home > Debian, Development, Documentation, English, GNU/Linux, open-source, php, Tech Crunch, Techie, ubuntu > HOWTO Build your own binaries of PHP Xapian bindings for Debian

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.

  1. Noora
    February 14, 2012 at 12:19 pm

    Thanks, still worked nicely on squeeze 6.0.4.

  2. Amazium
    April 11, 2012 at 1:34 pm

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

  3. James Aylett
    May 20, 2012 at 3:19 pm

    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.

  4. November 10, 2012 at 2:20 pm

    Doesn’t work on actual Debian Squeeze :-(

    • Yannick Warnier
      November 10, 2012 at 5:30 pm

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

  5. November 10, 2012 at 6:26 pm

    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 :-)

    • Yannick Warnier
      November 10, 2012 at 7:07 pm

      ok, thanks

  6. Ulf
    November 26, 2013 at 10:33 am

    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?

  1. May 20, 2012 at 3:19 pm

Leave a comment