Just something to think about for developers. This isn't about Moodle actually, but is something I got bitten with when testing two products that shall remain nameless but both are closely integrated with Moodle.
One specifies exactly the same system requirements as Moodle and the other specified PHP 5.1.0+. However, both have problems as it turns out that they both use features introduced in 5.1.3. There seems to have been quite a bit of feature creep through the PHP 5.1.x branch.
I hit this using Ubuntu 6.06 Long Term Support server edition. A reasonably popular server Linux which comes with PHP 5.1.2. The only easy(ish) way out is to roll-your-own PHP, but this throws in the bin the benefits of using the LTS version of the server.
I have been rather impressed with the caution in which Moodle has adopted new features of the PHP language. For example you need php 5.x to use the global search. Now it turns out I have written some code of my own that doesn't run out of the box with PHP 5. But as global search is a nice to have but not essential I can run this version of Moodle without worrying about the move to PHP 5. I expect the move to 5.x will come at some point but its a judgement call as to exactly when that happens.
PHP 4 will only be supported for another 62 days. I do agree that Moodle has done a great job of keeping Moodle functional for the largest number of users as possible. At the same time, IMHO server admins really do need to make the move to PHP 5. So I think the sooner you can get to PHP 5 the happier you will be. Thankfully, Moodle was able to avoid most of those growing pains which was no small accomplishment. Peace - Anthony
I half agree with you on the "server admins really do need to make the move to PHP 5", but two things are worthy of note...
- Linux distros and independent developers may support PHP4 for longer.
- There are many - literally thousands - of sites out there running PHP3/4 code that work perfectly well. Web apps that aren't maintained - proprietary or open - but work perfectly well, and custom websites with a little bit of PHP "on the side".
Sysadmin todays have an important % of sites that don't need PHP5 and that will break with it, often in subtle and hard-to-fix ways. The original programmer iss no longer around and the clients are only paying $9.99 for hosting. Yes, there are developers in fast-paced, top-of-the-line web apps that think that v4's shortcomings are the end of the world and that everyone must follow at whatever costs... even though we all know how to workaround them every day
And yet, we just deal with slighly different syntax in js (several variants of DOM too), php (v4,v5), html/xhtml, css and all the wonky versions of SQL we have to contend with. Most developers here also deal with one or more of perl, ruby, bash, python and others.
It is a pain - yes - but we do it to support a wider range of end users. Because for everyone else, all this PHP version hoopla is just fire-and-motion like Joel describes it http://www.joelonsoftware.com/articles/fog0000000339.html
I like PHP5 - just like Apache v2... both are just different enough that it's a pain to switch and not different enough to make it clearly worthwhile for everyone. And most of the projects that are a big success today started in the days of PHPv3 - so the legacy doesn't quite help!
I don't have a problem with you naming the other system
I tend to agree with you about these requirements and I didn't realise that we had introduced a 5.1.3 dependency actually. I tend to think of point releases of PHP being stable in terms of features, which I guess is wrong. I would expect changes between PHP 5.1 and PHP 5.2 but not PHP 5.1.3.
In general since Mahara is a relatively new project (only a bit more than a year old), we made the decision to base on PHP 5 rather than support 4 and I still think that was absolutely the right decision (PHP 4 is offically EOL at the end of this year from PHP anyway) as the benefits of PHP 5 are pretty big especially when you look at Mahara's plugin system and how we're using OO features that are just not in existence in PHP 4.
I know Moodle 2.0 is supposed to be PHP 5 only but I don't know PHP 5.what - anyone know?
Yes, I would have chosen PHP5 for a new project too. I was very surprised that they had added new features between 5.1.2 and 5.1.3 but there you go. I suspect that the Moodle2/PHP5 thing will be decided on its merits nearer the time.
If it was today, I would argue for 5.1.0 (the minimum 5.x requirement currently) I guess.
P.S. Mahara is looking really cool.... now if only I could run it on my server
As far as:
> P.S. Mahara is looking really cool.... now if only I could run it on my server
.... we could help you out there, you know
It's a big change from my older very conservative policy but Moodle 2.0 is some way off yet.
Debian stable currently supports 5.2(!), so by the time Moodle 2.0 comes out I'd hope a lot of the other distributions have caught up.
Of course this is the sort of problem which the idea behind the gophp5 site. For years the rate of adoption of php5 has been slow, developers don't develop for it because hosts don't support it. As its not required for many web apps, hosts don't upgrade and the problem is circular (and this doesn't help drive distributions cycles either). At last php4 is being end of lifed and hopefully we can start afresh with newer advantages of the language.
So i'm glad we can upgrade and moodle can evolve to take advantage of it. Of course I also run Debian Stable/Solaris so its not a problem
I do think that PHP5 is hampered because PHP4 is "good enough" and PHP5 is a bit less stellar than most had hoped.
There is very little reason to go PHP5 other than PHP4 being orphaned - and PHP5 actually breaks a lot of toys. Some things have been cleaned up in PHP5 but not enough to justify the effort and the breakage.
IMHO the main reason Moodle would have to hop on the v5 wagon would be a rock solid DB abstraction layer... and I am looking at PDO and... I'm not that convinced of it! Not that it's bad, but it's just not rock solid, it's not fast, and it is missing things that AdoDB has today. Useful things.
In other words - I haven't seen anything that PHP5 does that PHP4 doesn't... with the following caveats
- not yet at least! happy to be convinced otherwise
- "anything that it matters for moodle" mainly
Gophp5.org should be Makephp5worthwhile.org imho
PHP 5 has:
- Exceptions
- Much better OO:
- public/private distinction
- abstract classes
- interfaces
Exceptions!!!
Using proper OO and inheritance makes a HUGE different for plugin APIs - in particular you can force plugins to implement methods by declaring them abstract in the parent class.
Seriously, I agree. I can live with functions (I used a complicated OO architecture for my first moodle module, but decided to pack it in and go back to functions for future ones, as it didn't make sense when none of the support infrastructure was OO; I do use bits and pieces of OO code to do various things) but being without exceptions is a killer. $success = $success && call_each_bloody_function()? And no useful information when (if) you do finally check that $success variable? ARGH. Thankfully, we are on PHP5 here.
I think really the key point, which several others have mentioned, is that you don't have to upgrade to Moodle 2.0 (and anyway, not sure what the roadmap says but I reckon it's an entire year away). 1.9 should be pretty good for a while.
As for those who do want to upgrade, no doubt our sysadmins will be annoyed if we tell them we need 5.2 and Red Hat Enterprise is still on 5.1 by then, but they'll get over it.
--sam
Well there you go. That's a bloody good reason, if you ask any competent sysadmin.
Having developed PHP5 and 4 apps, 5 is better. Much better. Exceptions? Public/Private? Supported by upstream? It's a no-brainer.
It's a no-brainer
Sure - for us as developers. No doubt. For the rest of the world, specially for users, it's not so clear.
If you are the sysadmin above, with 200 hosted sites at $9.99 and a potential nightmare of PHP4-isms, what do you do? If you are the non-geeky client that gets a call or email from the hosting company saying that the site you paid top dollar 3 years ago will probably break?
And there are a lot more of those sysadmins and their clients than there is of us
WRT the nicer OO support - it is nice, but it does not allow you to build anything you couldn't build before. I've coded with and without private/public properties/methods, an I wasn't more productive either way -- I just used the underscore prefix notation.
Similar wrt exceptions. Great for people who love them. For me - they are a bit too GOTO-ish / action-at-a-distance-ish - see http://www.joelonsoftware.com/articles/Wrong.html
Anyway - the important point is that, AFAICS, PHPv5 is a an incremental update that, instead of being a no-brainer for everyone, breaks quite a few toys. We like new toys, so we argue it's worth it. People that have older toys that are perfectly fun aren't so sure
And that's what I think people are missing.
(If you look back, the v3 to v4 transition was trivial! Why? Almost no regressions, and lots of very obvious improvements.)
With regard to not building everything you couldn't before - sure, but that's a moot point. We'd all be using assembler, by that logic.
About exceptions - meh. There is a grain of truth in there - for, as he says, open heart surgery. Moodle isn't open heart surgery. Exceptions has given Mahara a really good way of gracefully handling error conditions in the code, without needing a bunch of code like this:
if (!$result = do_something()) {
handle_error('zomg');
}
Anyway, to summarise - why the big bender against a new major version of Moodle using a new major version of PHP? I'm sure moodle 1.X will continue to get support for a while yet.
I am just explaining that there are good reasons why non-developers out there aren't rushing to v5 -- and it is just bad attitude to tell them what to do. That is what I don't quite like about the GoPHP5 site. And that Moodle isn't missing out on much so far, so we don't have a big driver to badger people into switching.
Just to put it in perspective - most of the time in Moodle we do just the opposite to widen our support. Think SQL compat issues between - MySQL, MSSQL, Oracle and Postgres! Dropping MSSQL, Oracle and Pg support would probably affect less sites than dropping PHP4 support. Perhaps even more end users in spite of the large scale Pg setups.
And it would simplify our code a lot more. We can nuke a couple thousand lines of code in a jiffy.
I'm ok with going v5 for Moodle -- we can do it to cut our testing efforts on it, or for a new feature we can't do on v4 (but I don't see any).
The GoPHP5 site doesn't make me happy though -- there are enough warts in the switch to v5 that it's understandable that people are delaying it. And the GOPHP5 crowd don't even care to mention the incompatibilities, or to provide tools to help spot them or anything -- it's only rah-rah. Switch to PHP5 today and all will be well - honest! If your ISP switches to v5 overnight don't worry it will all be well!
Maybe we could instead support 1.9.x for much longer period than any previous version which would be IMHO fine for people stuck with PHP4 or PHP 5.1 ...
For example, it would of course be folly to trust a cheap web host to run a whole University.
There is a lot of merit to that comment...and it doesn't take a "whole university".
http://moodle.org/mod/forum/discuss.php?d=20375
Steve
the last time I checked the server I was on, had around 800 other websites hosted on it. Maybe I'm being unreasonable and expecting too much from a shared webhost?
Sounds like there was about a whole university's worth of other users on the webhost (800 sites is about 3x the number of active courses we had at the 7000 student University I worked at).
Any of those 800 sites using Drupal, Postnuke, Mambo, Xoops, Xaraya, Gallery, PHPBB, Rails, Plone, etc. would count toward the number of concurrent users on the database server.
Worse, if the host is not running a clustered database server they can't increase system resources on their database server to meet sudden loads - every site using the db server is stuck with the processing power, disk speed, and memory limits of their database server.
Umm ....Exactly...hence, I think there is a lot of merit in that comment....
I am afraid Moodle 2.0 will not run properly on 9.99$ hosting anyway...
Steve
If your ISP switches to v5 overnight don't worry it will all be well!
This was a bit of an in-joke
I was involved in an not-really-planned v5 upgrade on a server we manage -- involved, bah, I was guilty of it. It wasn't pretty, to say the least: lots of things broke and it took several days of work to get everything going straight again.
Luckily, noone tried to kill me
Therefore, you should be fully behind it, because it will encourage people and webhosts to seriously consider the move. You can't help that the move will break stuff. Shit happens, and we blame the PHP developers for that (they're a bunch of muppets I have an entire day of rants for, but that's another story).
The final upshot is - PHP5 is here in all it's glory, PHP4 will _not_ be supported for security patches etc, so there is nothing you can responsibly do other than make your new software work with the newer version.
Staying with PHP4 because it "still works" is like working at a job you hate because they "still pay you".
The other thing is that we (as a pretty big software project) can help push those hosts/sysadmins to upgrade their old servers by raising our requirements. It's not like PHP5 is new ... it's years old already. And PHP4 has now been dropped by the PHP team.
For those few who will really not be able to switch from PHP4, even at the end of next year, well, Moodle 1.1 -> 1.9 will still work perfectly well. I don't think such users are really going to be interested in cutting edge features of Moodle 2.0 anyway.
We do exactly the same on our '1.x.y+' branches, and even worse - we *really* do not change the version number so your 1.5.4+ and my 1.5.4+ can be radically different. RedHat, Debian and other distros do change the version number of the RPM package if you look closely. It will say 5.2-11 - meaning 11th revision of it.
I do know
It actually runs very well on my test/development machine which is running the latest version of Ubuntu. It's just going to be a pain for the production sites that are running the (still current) LTS version of Ubuntu. There's no solution I can think of that won't involve someone coughing up for a few hours of consultancy time.