What happened to the PHP bindings packages?
The GPL (which Xapian is currently licensed under) and the PHP licence (which PHP is licensed under) are incompatible due to the latter's naming restrictions on derived works. See ticket#191 for more discussion of this.
The result of this is that distributing binary packages isn't legal. Our understanding is that distributing the source code is OK, and building binary packages is also OK.
If you're using Debian or Ubuntu, it's not hard to build your own binary package for the
PHP bindings. First, make sure you have deb-src
entries in /etc/apt/sources.list
(and/or the files in /etc/apt/sources.list.d/
- if not add them so apt-get source
knows
where to get sources from. They should look like the corresponding deb
entries, except
the lines start deb-src
instead of deb
.
PHP7
NB: You need xapian-bindings >= 1.4.5-1 since earlier versions don't support PHP7.
Debian 10 (buster) and newer, or recent Ubuntu
# Change this to the PHP 7.x version you want to build for. v=7.2 sudo apt-get update sudo apt-get build-dep xapian-bindings sudo apt-get install devscripts php$v-dev php$v-cli apt-get source xapian-bindings cd xapian-bindings-1.4.* echo php7 > debian/bindings-to-package debian/rules maint PHP7_VERSIONS=$v debuild -e PHP7_VERSIONS=$v -us -uc cd ..
Now go to "Common steps" below.
Debian 9 (stretch)
First you need to enable stretch-backports if you don't already have it enabled. Then use this modified version of the above instead:
# Change this to the PHP 7.x version you want to build for. v=7.2 sudo apt-get update sudo apt-get build-dep xapian-bindings/stretch-backports sudo apt-get install devscripts php$v-dev php$v-cli apt-get source xapian-bindings/stretch-backports cd xapian-bindings-1.4.* echo php7 > debian/bindings-to-package debian/rules maint PHP7_VERSIONS=$v debuild -e PHP7_VERSIONS=$v -us -uc cd ..
Now go to "Common steps" below.
Common steps
This runs the testsuite as part of the build, which we recommend as it helps to ensure you get a build that actually works. But if you want you can skip running the testsuite by changing the penultimate command above to:
env DEB_BUILD_OPTIONS=nocheck debuild -e PHP7_VERSIONS=$v -us -uc
Then you can install the built package:
sudo dpkg -i php7-xapian_*.deb
Installing the package should enable the module automatically.
PHP5
For Xapian 1.2.19 and later the following should work if you're using a distro which still has PHP5 packages:
sudo apt-get update sudo apt-get build-dep xapian-bindings sudo apt-get install devscripts php5-dev php5-cli apt-get source xapian-bindings cd xapian-bindings-1.*.* rm -f debian/control debian/*-stamp echo php > debian/bindings-to-package debian/rules maint PHP_VERSIONS=5 sed -i '/^X-Dummy:/d' debian/control debuild -e PHP_VERSIONS=5 -us -uc cd ..
This runs the testsuite as part of the build, which we recommend as it helps to ensure you get a build that actually works. But if you want you can skip running the testsuite by changing the penultimate command above to:
env DEB_BUILD_OPTIONS=nocheck debuild -e PHP_VERSIONS=5 -us -uc
Then you can install the built package:
sudo dpkg -i php5-xapian_*.deb
That will enable the module automatically unless you're using a very old Debian or Ubuntu version in which case you will need to enable it in your php5 configuration. Typically (but it depends on your configuration) the file is /etc/php5/apache2/conf.d/20-xapian.ini
and should contain:
extension=xapian.so
and then restart Apache2 (or the corresponding PHP server) with something like sudo service apache2 restart
Solutions for some build problems
If you are building the package on a partition mounted with the noexec
option (like /tmp
sometimes is), you might get a debian/rules: Permission denied
message. You need to build somewhere where executable files are allowed - e.g. use your home directory instead.
If you are having issues with the debuild command on Ubuntu, you can try using the external PPA provided by Olly here: https://launchpad.net/~xapian-backports/+archive/ubuntu/ppa