This is another "state of php in gentoo" article. Specifically, I want to talk about using SLOTs with PHP.
The current situation was created during the switch from PHP-4 to PHP-5, one of the biggest and more drastic in terms of features. PHP-5 added a full blown object oriented system, ending PHP's dubious fame as a highly advanced template engine and easing work on large code base projects. Clearly, porting your code from using PHP-4 to 5 was a tremendous effort if you wanted to take advantage of all the new and powerful features PHP-5 offered. So the then gentoo php team decided to make it possible to install PHP-4 and 5 alongside, easing migration testing and extension usage.
What they did was to slot PHP to it's major version. This is why today you're left with
dev-lang/php
in one slot: "5".
In a
meeting on 11th April, the gentoo php team decided to halt decisions on slotting less (i.e. removing slotting) or more (i.e. on minor versions), due to manpower restrictions. This was chiefly due to our desire to get php-5.3.2 into the tree as fast as possible and we needed every minute we could contribute to gentoo at that time to this task.
Now that php-5.3.2 is in the tree and I'm slowly killing the remaining bugs left (helped, and mostly driven, by many friendly contributors, thank you!), we can focus on other areas to improve the overall quality of gentoo's PHP offers.
So slotting became an issue once again.
In an informal meeting, we agreed that removing slotting was the easiest solution, but not the best. While slotting to minor versions increases ebuild complexity and comes with it's own problems (you need a way to select the "active" PHP installation to run for the apache module, for example), the advantages in migration testing and also for shared hosting providers, who want to offer more than one PHP version, trumped the relatively low cost of slotting.
Here's a short pro-contra overview of minor version slotting I came up with:
pro
- test your code against the most current PHP version on the same machine
- provide your customers the PHP they want
contra
- need to remove slots you don't need (or they'll take up hard disk space)
- increased complexity in configuration
That's pretty short and I'm sure you can come up with more benefits and disadvantages. Do let me know in the comments!
I'm still somewhat disappointed with the lack of "end-user" benefits in this move. If you just want to run that cool webservice your friend has been telling you about, you'll
emerge php
and will receive slot updates instead of the normal ones thereafter. You regularly want to run
emerge --depclean
, so you don't keep around PHP slots you no longer need (thanks to darkside for helping me with this one).
Another hurdle will be that we require you to "enable" the PHP version you want via eselect to benefit from the slotting. This affects for what PHP version your PHP extensions like apc or suhosin will get compiled (each minor version has a different ABI, so for each SLOT you need a special build). We're trying to make it so that not "enabling" anything will guess the correct PHP version (probably your highest slot), but that's not sure right now. You will also use eselect to switch from one php apache module to another.
Speaking of apache modules, I've another proposal: currently, Gentoo supports a highly experimental feature called
concurrentmodphp. It's a USE flag for
dev-lang/php
and enables you to run multiple versions of php in the same apache. Usually, this results in a symbol name clash of the php modules you try to load, but with this USE flag enabled, it should work. That said, I never used it, did not test it and upstream will tell you to rebuild without it if you do and run into problems. It's in no way supported neither by Apache or PHP. What
is supported is running multiple versions of whatever you like via cgi (fpm, for that matter). So if you want that functionality, you can get it anyway, without causing maintenance problems for the team.
So here's the proposal: I will drop the concurrentmodphp functionality starting in August, if nobody objects with a technical argument on why to keep it. I'd like to hear cases where concurrentmodphp solves a problem fpm can't handle.
Anyway, if you want to help with the slotting efforts, please visit #gentoo-php on freenode, tell us to pull your ideas from your git repository (you can clone your local copy off of our
slotting branch) or open bugs explaining why such and such change in said branch won't work, kills kittens or is otherwise undesirable. As always: comments welcome!