Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As Xapian's been dropped from the Ubuntu repositories, I'm attempting to build my own .deb from the instructions here:

I can only get things to progress beyond the first few seconds by leaving out 'rm debian/control', but if I do, it looks as if the Python and Ruby bindings are building and passing their versions of smoketest correctly.

However, the PHP part of the build is failing with this error:

/home/charlie/xapian-bindings-1.2.8/php/smoketest.php:38: include(xapian.php): failed to open stream: No such file or directory
FAIL: smoketest.php

There's a xapian.php file in /home/charlie/xapian-bindings-1.2.8/php/php5/ but if I copy it to /home/charlie/xapian-bindings-1.2.8/php/ or change the path to it in smoketest.php, the build fails right near the start with:

dpkg-source: error: aborting due to unexpected upstream changes

Unfortunately I'm out of my comfort zone building from source. Anyone got any ideas?

Edit post James' answer:

Builds fine if I follow instructions exactly. I built it on a test VM initially, but that didn't build the PHP package as PHP itself wasn't installed. Obvious gotcha, but worth mentioning.

Installing generated the following error:

Setting up php5-xapian (1.2.8-1) ...
Processing triggers for libapache2-mod-php5 ...
dpkg (subprocess): unable to execute installed post-installation script (/var/lib/dpkg/info/libapache2-mod-php5.postinst): Permission denied                                                               ssion denied
dpkg: error processing libapache2-mod-php5 (--install):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:

It's only a script for restarting Apache. Stopping Apache before running sudo dpkg -i php5-xapian_*.deb prevents the error. Xapian now shows up in phpinfo(). Job done. Thanks.

share|improve this question
up vote 4 down vote accepted

The problem is that the Debian build system builds in a separate directory to the source files, and that approach currently has a problem with running the PHP bindings smoketest. Until this is fixed properly, you can get things working by running the following commands (adapted from the Xapian FAQ on PHP bindings for Debian & Ubuntu, which are based on the information you'd already found):

sudo apt-get build-dep xapian-bindings
sudo apt-get install php5-dev php5-cli devscripts
apt-get source xapian-bindings
cd xapian-bindings-1.2.*
rm -f debian/control debian/*-stamp
env PHP_VERSIONS=5 debian/rules maint
sed -i 's/include_path=php5$/include_path=$(srcdir)\/php5/' php/
dpkg-source --commit

At this point you'll be prompted for a patch name (use something like fix-php-buildtests), then dumped in an editor to document the patch, but you don't care about that so you can just save and exit the editor. Then:

debuild -e PHP_VERSIONS=5 -us -uc 
cd ..
sudo dpkg -i php5-xapian_*.deb

And you're done.

The mailing list thread dealing with this problem hasn't appeared in GMane yet, but it's available in the Xapian mailman archive.

share|improve this answer
That's great James, thanks. I've got half a dozen 12.04 installs running at the moment. Once they're done, I'll give this a try and post back. – jetboy May 20 '12 at 18:28
Added a follow-up to the original post. Thanks for your help. – jetboy Jun 28 '12 at 20:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.