I had a gut-feeling using slots to quickly switch between different versions of PHP in Gentoo would be straightforward and it was. The only piece of the puzzle that eluded me for a while, in the end, was working out how to tell portage to install a specific version. This is acheieved with an equals sign. As such: (Assuming in this instance 5.2 is already installed.)
# emerge \=dev-lang/php-5.3.3-r3
Then to switch versions:
# eselect php set apache2 X
# /etc/init.d/apache2 restart
Note: To display available versions when 'eselecting' use:
# eselect php list apache2
As a developer, one of the great things I love about Gentoo (Linux distribution with BSD 'ports-like' package management) is the feeling it gives you that eveything you do to your system has an undo button. (For the record, I have at least come to my senses about this need in a production situation.) A great example of this is layman, which I think is fair to say is a slightly more intuitive version of managing an apt sources file. Today I realised there is a portage overlay (for use with layman) that I have been missing out on and perhaps it's because it's a fairly recent addition but it comes just in time for me to try and get more serious about hacking in Perl.
With the perl-experimental overlay I anticipated the knock-on effect might be that I am no longer tempted to write a script for keeping my /etc/portage/package.keywords file sorted alphabetically automatically. I was half-right (thanks to a useful awk command from the Gentoo wiki) but in the end this need paled in significance compared to the delights of coming across a more up-to-date utility for handling cpan builds and then ending up with a system for reliably predicting where generated ebuilds from this utility will land in the filesystem. Not that it matters that much, I suppose.
Read More...