Francis Irving
2006-Dec-15 08:15 UTC
[Xapian-discuss] Running two versions of Xapian on one server
This is really a general Unix/Linux question. I install Xapian manually from source on this particular server, and am using both the Perl and PHP bindings. I would like to run a (much!) newer version on the same server at the same time as the old one. This is so the website and existing indexer can continue to run, while I build the new index and check things work with the new version. How can I build/install a new version of Xapian, so I explicitly tell Perl and/or PHP to use it? I'm wondering if something like I just build it, and set LD_LIBRARY path to the appropriate place of the build tree when calling Perl? But that doesn't help with testing with mod_php on the web server. What do people do, and what suggestions do they have? Francis -- Make this petition bulbous... http://petitions.pm.gov.uk/lightbulbs/
James Aylett
2006-Dec-15 12:09 UTC
[Xapian-discuss] Running two versions of Xapian on one server
On Fri, Dec 15, 2006 at 08:15:25AM +0000, Francis Irving wrote:> This is really a general Unix/Linux question. I install Xapian > manually from source on this particular server, and am using both the > Perl and PHP bindings. > > I would like to run a (much!) newer version on the same server at the > same time as the old one. This is so the website and existing indexer > can continue to run, while I build the new index and check things > work with the new version. > > How can I build/install a new version of Xapian, so I explicitly > tell Perl and/or PHP to use it? I'm wondering if something like > I just build it, and set LD_LIBRARY path to the appropriate place > of the build tree when calling Perl? But that doesn't help with > testing with mod_php on the web server.There are two things you need to do: 1) install parallel Xapians You can either do this into a different directory, or (in theory) in the same directory providing the so version number has changed (which it almost certainly will have done in your case). Separate directory is easier to control. 2) install parallel *bindings* to Xapian This is harder. You could hack it to call the new bindings something else, but I don't know how to do this for Perl, and doing it for PHP is probably quite fiddly. (I can figure out how I'd attempt it, but ... eww.) An easier (but less pleasant) approach is to build parallel *languages*, each with a binding to the right version of Xapian. This is reasonably straightforward for Perl, but for PHP you're going to have to either use the fastcgi SAPI, or run a second apache which loads a second PHP. Bit nasty, but it will work. The main reason it's difficult to do with the same language and different versions of the bindings is that it's not just the Xapian library that has changed in the intervening versions - the bindings so will have changed also :-/ J -- /--------------------------------------------------------------------------\ James Aylett xapian.org james@tartarus.org uncertaintydivision.org
Olly Betts
2006-Dec-15 15:48 UTC
[Xapian-discuss] Running two versions of Xapian on one server
On Fri, Dec 15, 2006 at 08:15:25AM +0000, Francis Irving wrote:> How can I build/install a new version of Xapian, so I explicitly > tell Perl and/or PHP to use it? I'm wondering if something like > I just build it, and set LD_LIBRARY path to the appropriate place > of the build tree when calling Perl?This part is easy - you just specify the location of the xapian-config script for the appropriate installation of xapian-core when building the bindings using XAPIAN_CONFIG. E.g. for xapian-bindings: ./configure XAPIAN_CONFIG=/usr/local/newxapian/bin/xapian-config And for Search::Xapian (assuming sh, bash, or compatible shell): XAPIAN_CONFIG=/usr/local/newxapian/bin/xapian-config perl Makefile.PL You don't need to set LD_LIBRARY_PATH at all (not even at run time) since we use libtool to do the linking, and libtool will automatically set an rpath when linking against libraries which aren't in the ld.so search path. As James says, the tricky part is to get both versions working with PHP and Perl. For PHP, you could probably achieve this by not loading xapian.so in php.ini, but instead use the PHP "dl" function to load a particular xapian.so. Cheers, Olly
Olly Betts
2006-Dec-20 04:42 UTC
[Xapian-discuss] Running two versions of Xapian on one server
On Fri, Dec 15, 2006 at 08:15:25AM +0000, Francis Irving wrote:> I would like to run a (much!) newer version on the same server at the > same time as the old one. This is so the website and existing indexer > can continue to run, while I build the new index and check things > work with the new version.There's another approach to this (which I mentioned to Francis in person last weekend, but might be of wider interest) - you can create a chroot environment with the new stuff in and use that. This keeps everything nicely segregated, so there's no danger of damaging the live installation while setting up the new version for testing, and it's easy to clean up the test environment once you've migrated the live installation. Building the chroot is easy on Debian (use debootstrap or cdebootstrap). I'm not sure if other distros or operating systems have similar tools. If not, it's possible to do by hand if you know what you're doing. Or instead of a chroot, use a full virtualised environment (with Xen or UML or something similar) - similar conceptually to using a chroot as above, but rather different technologically. Cheers, Olly