Should Drupal move to PHP 5?
In one word: absolutely.
In one sentence: if we don't, the drupal project will die along with PHP.
My friends, PHP is dying. Every day, the best programmers are moving to, faster, better constructed, more powerful languages such as python and ruby. The developers of PHP have been aware of this for some time. That's why they released PHP 5*.
PHP 5 was a significant counter attack on PHP's biggest weaknesses. Among other things, it allows PHP to be a true object oriented langauge. However, the real meat of PHP5 isn't the flung OOP buzzword, but the fine details. For example, being able to pass a variable by reference in a foreach loop... however, this post isn't about PHP 5.
So if the PHP developers aren't to blame for PHP's impending death, who is? Well, that would be us. Or more specifically, those who champion sticking with PHP 4 on "practical" grounds. If you ask me, I see nothing practical about making our technology obsolete on the grounds of "playing it safe" .
The entire situation with php 4 vs 5 is much as George Orwell described the decay of the English lanuage:
But an effect can become a cause, reinforcing the original cause and producing the same effect in an intensified form, and so on indefinitely. A man may take to drink because he feels himself to be a failure, and then fail all the more completely because he drinks.
If I may be so bold, its the proponents of PHP 4 support who are keeping this cycle from being broken. All it takes is for someone, somewhere, to stop drinking the php4 support koolaid. I, along with many others, would be proud if it were the drupal community that draws the line, and stops drinking the koolaid of our demise. It would be a real chance for us to show leadership to the open source community. My guess is that others will follow our lead, which will result in hosting companies finally getting off their lazy, fat, grotesquely slothful asses and upgrading their freaking PHP version (its not that hard! for gods sake!).
What would have happened if 80 percent of drupal users and developers had never upgraded to 4.7 on the grounds that "4.6 worked", and "migrating is such a pain", and "most modules aren't compatible with 4.7".
Sooner or later we'd find that module developers weren't interested in developing for 4.7 because "most of the user base is still using 4.6". Its not difficult to imagine what kind of effect this would have had on drupal development.
I imagine this is exactly how the PHP development community feels. They put a lot of hard work into making our lives easier (believe me, after getting used to PHP 5, you will refuse to develop against PHP 4 -- and if clients servers don't support php 5, all you have to say is "i can develop 30% faster..."[+], and trust me only an idiot of a client won't upgrade).
Not only have we forgotten to say thank you; we've largely sent their gift back with a "return to sender".
***
If drupal is to truly evolve, its going to need to evolve beyond an obsolete version PHP. I swear this point should be obvious to everyone, but it seems it isn't.
We can never future proof drupal, but we can at least make drupal more future resistant by beginning to take small steps toward dropping support for php 4.
My recommendation would be to announce Drupal 8 is dropping support of PHP 4. The optimist would say that this gives users a good 1 year warning. Drupal developers know this translates to at least 1 year and 3 quarters.
The point is we give users sufficent warning to upgrade their hosting to something more suitable for an application like ours, which has far outgrown the awkward lanky adolescent that was PHP 4. Those who refuse to upgrade hosting (in all reality, site5 offers more for less than most every hosting company AND supports php5... so actually, smart consumers can save money by moving to php5 supporting hosts...) can find another CMS.
Meanwhile, just imagine what we could do to the drupal codebase with PHP 5. My inkling is that Chx is already thinking about this. :-)
Note:
* There's a six too!
+ hopefully you are charging enough that 30% increase in productivity is a greater than the 100 dollars it costs to host this and 3 other sites at site5. If you aren't, you really need to raise your rates.
Comments
Yeah man, I totally agree as
Yeah man, I totally agree as well. With new programming languages it is very hard for PHP to live up and excess.
________________________
Software Download
PHP and shopping carts...
@tie: about your comment: [...]Imagine the customer reaction when their PHP apps start breaking. When the shopping carts, and the CRMs stop working, because their developers have not yet released a PHP5-compatible version.[...] Could this be true? I will ask my hosting/provider firm if our online shops can be in trouble soon.
While PHP appears to be
While PHP appears to be dominant today, the rapid growth in new projects in Ruby indicates that it is currently positioned as “the language of the next wave of applications.” This is consistent with what I’m hearing and seeing from many new startups.
Janet Kellman, software reviews manager
Agree
I totally agree with you.
Shortsighted...
"...which will result in hosting companies finally getting off their lazy, fat, grotesquely slothful asses and upgrading their freaking PHP version (its not that hard! for gods sake!)."
It is *much* harder than you think. A hosting company cannot just compile the new PHP version and replace the old one. Imagine the customer reaction when their PHP apps start breaking. When the shopping carts, and the CRMs stop working, because their developers have not yet released a PHP5-compatible version. And what must the hosting company tell those people? "Sorry sir, but this application no longer works on our servers.". This would be one very unlucky and very dead hosting company.
The process of upgrading to PHP5 is *painfully slow* for the hosting companies, with a lot of bumps for the non-tech-savvy customers (90% of all customers). Saying "it's not that hard" is simply ignorant.
What about making it an easy
What about making it an easy "opt in". I am not saying you should switch php versions out of the blue, rather I'm attacking hosts that say, "its not an option", usually accompanied by some sort of "its not proven and secure" bullshit.
Opt in
Making it an easy opt-in means that the provider has to re-work some parts of their Control Panel/Cpanel appliactaion (and not only the visual parts, mind you), to provide this easy opt in. As you would expect from your hosting company, such an option should be well though out. What about customers who need PHP5 for one applicaiton, and PHP4 for another one? What about any PHP control mechanisms (enabling/disablig PHP for some folders, for example) - they should be doubled for both versions. And, lets not forget that this entire setup requires two different versions of PHP being present on the same server, which is something people are trying to avoid (a single-version setup is much more straightforward).
I am not saying it is impossible to do it, or do it the right way, but it is certainly not as easy as you suggested. It is not trivial to implement, and this is why some hosting companies may be reluctant to tackle the challenge.
This being said, I fully agree that hosting companies *must* get off their asses and find a way to provide PHP5 to their customers. What I dispute is the part where you say it is easy - you are encouraging people to oversimplify the problem. My advice to the users would be: Ask yor hosting provider for PHP5, even more, *demand* PHP5 to be deployed in a reasonable timeframe, but don't try to explain to your hoster how easy it is.
And yes, the "proven and secure" excuse is bullshit - PHP5 has been around long enough to prove itself.
I say yes!
Lovely article. Personally, I use PHP(5) for most of my projects, but I've been stepping into the RoR fields ever so slowly... TDD and the "ruby thinking" is new to me, so.. still not making any major projects in it, but.. :)
Upgrading isn't always bad, and I'd like to see some internal rewrites of Drupal code, even if tit makes it non-backwards-compatible.
_________
project honeypot
............
I do not quite agree ... As an user of web who is niether too geeky and not too newby either I feel :
Web is not just what big corporates OR big developers like drupal, plone etc are BUT is in fact a HUGE majority of users who can do some amount of programming / theming. Despite all security and compactness concern they will go along with a language that is EASY. These people are the MASSIVE strength of the web, and PERL did not work for them the way PHP worked. If PHP or CMSes based on php go TOO complex ( like perl did ) either they will LEAVE this or go to another language which will be born out of these and be easy like php3 ( or 4 ). If they do so, the question can be WHO really bothers ? Probably big developers need not bother as they can still survive as the web has also growing number of paying biggish clients.
Small 'developers' ( popularly known as hobbyists but many have quite biggisg sites and some have sites that can put coporates to shame ) i.e. those not too geeky and not too newby will certainly stick to php 4x or 5 as long as their scripts work without much hassle but once things start becoming complex and cpu hungry like perl they will either perish / force webhosts to stick to php4 - 5 combo / shift to some newer language which will essentially be what php was to perl, and will be EASY on brain as well as hosting fees like php3 or 4 or 5.
Is ruby or python going to take over ? NO ! With all the hype and 'thunder' that they may have or have not, they are NOT easy for the masses. I can understand that by myself and hundreds like me on the web who meet in various forums and chats. None of these languages despite a few years appearances have so many ready made applications and neither is so easy for one to write an app.
Web as it is now has reached a stage of evolution like human - no further new species. There can be great new fashions, great new rockets and some weird genetical hybrids BUT not really any more new species :)
Regards
I agree with this.
I agree with this...
For an user of web this is another thing, drupal is great and powerful, but something have both sides.
----
software reviews
I can only agree
I can only agree. ** Parable on**: It really is a little bit like people who still hold thight on MS Windows just because "of the pain of migrating to another system", albeit they REALLY know that Linux or Mac would be a much much better option because it will not only safeguard them from viruses and other maladies but also offer a far more superior system, more up-to-date and more user friendly system at much much lower costs. But the human being tends to be an animal of custom, right?! ** Parable out** ;-)
Enterprise
As usual, let me speak as a corporate/enterprise Drupal user.
We no longer support or develop for PHP 4. We also want to discontinue MySQL 4.x.
We especially want to leverage the features of PHP 5 and MySQL 5 with Drupal. Supporting older versions in Drupal core is a drag on future development. (We'd like to drop Apache 1.3, as well, but that's another issue.)
The support for PHP 4 is an issue for folks who don't own/run their own servers. The question is: which user base is more important? That's a tough question, but I'd agree with Rasmus' point at OSCMS that if the developers move to PHP 5, the shared hosts will as well.
FWIW, we also have a core Joomla! developer (Jonah Braun) on staff, and he is very interested in this topic. The Joomla! community is facing the same issue. Jonah asked if we might be able to coordinate Joomla/Drupal releases to both drop PHP 5 at the same time.
The logic here is that both projects fear losing users/developers if one drops PHP 4 and the other doesn't. So it might make sense to coordinate that specific versions of each will drop PHP 4 support.
PHP4 vs PHP5
My reply is at http://buytaert.net/php-is-dead-long-live-php ...
I say in Drupal 7
I would even be so bold as to say that we should drop php5 for Drupal 7. I think your estimate for Drupal 8 landing in a year to 1.75 is unrealistic. I can't see Drupal 7 landing any earlier than Feb/Mar next year. If we are making Drupal 6 to run faster, and have more features on php5 than on php4, it would be fair to take the next step in Drupal 7 and drop php4 completely.
The truth is a bit more
The truth is a bit more complicated. The PHP5 release cycle has had a lot of troubles. The 5.0 series is basically not usable and the 5.2 series was only released half a year ago.
Also, the people who make the real decisions about what gets used are the people who decide which version of software gets shipped with their Linux distro. Since even Debian ships now with PHP 5.2 I expect that their won't be many reasons to support PHP4 by next year.
WRT python: It has been around for ages and never really gained momentum. To me, it is the language without applications...
python / perl
"WRT python: It has been around for ages and never really gained momentum. To me, it is the language without applications..."
Uh... you couldn't be more wrong. There are bittorrent clients written in python, huge production management systems for animation studios written in python, and several powerful web frameworks... written in python.
I program games in python. Civilization 4 was written in python.
As for Perl...
It's faster, better, and easier to do stuff with than PHP. Sure the syntax is scary; but the fact remains that PHP has over 2000 core functions and no common naming convention (though there is a fork of php that hopes to at least fix that) compared to Perl's lean 200.
I also like PHP 4's lack of namespacing and lexical scoping. fun times integrating a bunch of apps that all use a $db variable in their scripts. Terrible.
PHP is a fine language, but it's far from great or even good. It's just good enough to do things in and is very forgiving to non-programmers.
I agree that if applications built on PHP are to contine to be popular, the webhosts will have to start supporting PHP 5 at least. The main culprit in this are the cPanel/Plesk people: their web host panels only support a limited and "stable" set of software.... gross.
Go with a more advanced host.
Well put. Frankly, I agree
Well put.
Frankly, I agree with pretty much all you said.
However, if were to decide, I would announce now, publicly, that "Drupal 7 will be PHP 5 only". This gives everyone about a year. A year to do an upgrade that is really due. The current versions of all big distributions ship with PHP 5 by now. Most of the big hosters already offer PHP5 (maybe not as default, but as a choice). Most of those who don't will probably in a year, especially if their customers tell them now that "in a year I'll need PHP5".
If they don't listen to their customers, what a hoster is it then. Time to switch, IMO.
PHP is to blame too
I'm sorry, but I find this whole situation a bit silly, from the perspective of an open source CMS developer.
One thing that's been thrown around a lot is that most PHP developers are not 'smart enough' to use more advanced PHP5 features and/or that they are lazy to convert their code. Especially outsiders poke easy fun at projects like PHPMyAdmin, that are widely deployed, but contain some truly horrifying code (3+ line global statement in a 700+ line function).
But what does PHP itself offer? Very little. Huge parts of PHP are bizarre, mutant interfaces which have gaping holes in some places, but contain oddly specific algorithms elsewhere. The String API is a perfect example... And if you want to do image processing, you better check for the availability of each external library you use and get ready to do some heavy lifting yourself. What the language does offer is wrapped up in confusing, inconsistent function names in a flat global namespace. Is it any wonder that the average PHP programmer doesn't aspire to improve their code?
Even more noticable is that large open source projects (like CMSes) each have to reinvent the wheel for features that are essential today. And even plug-and-play libraries like MagpieRSS have to come with their own cache and database back-end, to be useful. There is very little code re-use out there too, because too many basic functions are different in each platform.
There is very little happening to improve this situation. There are code repositories like PEAR and PECL, but in reality open source projects simply cannot use them. Their average user will either have a hard time installing such extensions, or will simply be unable to do so due to host restrictions. You often need to fiddle with php.ini and include paths.
PHP's efforts in this area are remarkably unambitious, and we find that years after we started making PHP applications, people are still having the same problems.
In Drupal, we noticed that designers were having problems coming to the platform, and we changed that significantly in version 5, and even more in 6. Less technical PHP knowledge is required to create themes, and Drupal is smarter in picking up templates automatically. We worked hard on this, and I think it will pay off well. PHP can surely make similar efforts to improve the quality of PHP as a platform, encourage better code, more re-use, etc.
What is worse though, is that the PHP team's ambitions in general are just low. Sure, PHP5 was a nice upgrade, and offered some sorely needed improvements (e.g. XML). But the majority of PHP code today still looks the same as before. Where is the stuff that really takes us to new places?
Libraries like jQuery are bringing waves of innovation, but can only exist in languages like JavaScript, where the programmer can alter the behaviour of pieces of the language to suit their purpose.
I experienced this myself when I ported jQuery's CSS selector parser for fQuery. The PHP version was more verbose and not as elegant. Also, in spite of PHP5's reference improvements, you still can't do the following:
<?php foreach (my_function() as &$value) {} ?>Heck, in PHP, you can't even redefine a function. And I recently asked Rasmus himself whether PHP would ever have closures (like JS), and he said he thought it was very unlikely, because most PHP users would not use them. In my opinion, that's short sighted: adding a functional flavor to the language is sure to open up cool new possibilities. It would make PHP more attractive in the eyes of the academic/comp-sci crowd and would steal some of Ruby's thunder too.
When will we see statements like
foo = o.value || 'default value'in PHP?Will we ever be able to change Form API to use SimpleXML's faux object/array mix syntax?
Will we ever get named function arguments?
How about string range subscripts like
$string[0..-1]or$string[$begin..$end]? Same for arrays?Will they ever add a native syntax for regular expressions that doesn't require quote escaping?
Will
preg_replace/eever be fixed?What about arrays defined with
[]rather than the bulkyarray(), which you can index immediately?e.g.
['foo' => 'You chose foo', 'bar' => 'You like bar'][$var]How about exposing information about ongoing file uploads through the session object, so you can perform parallel polling requests through AJAX?
The list goes on and on and on. As a platform, PHP is looking dated. Sure, we can slowly creep towards PHP5, but it only offers relief in some small sore spots. On a grand scale, Drupal will keep having to do what it always does: wrap native APIs to fix bugs, provide abstraction and unification APIs and generally cram a whole lot of concentrated ass-kicking in code that's slowly, but surely creaking at its seams.
PHP6 is a small twinkle on the horizon: proper Unicode support could convince some people to switch and can be used to make things like locale cleaner. However, since it needs to be enabled server-wide, it's probably going to be defaulted to off for quite some time, and we'll have just another flavor to support: PHP6 without native unicode (but with some extra APIs).
In light of this whole situation, I find the suggestion from the PHP team that open source projects drop PHP4 support a little arrogant and hypocritical. We're not about to drop a significant portion of our audience: that's the same argument they use for maintaining security patches for PHP4. If newer PHP versions can offer killer functionality, that makes life easier for everyone involved in the LAMP stack, it'll be much easier to convince hosts and users to upgrade.
PHP5 is like IE7: it improves things in a way that is badly needed, but in the end, it's still not that good, and you still have to support IE6 anyway.
Best rant ever...
Best rant ever...
Most irritating "feature"
Why can't PHP process GET/POST requests with duplicate variable names? Why must we use the [] trick to force PHP to treat it as an array?
If PHP would implement a "request" object like other languages has done, everything would be much better. Give me request.getParameters() now!
Me?
Of course. There are a lot that could be done -- fQuery in core, using simplexml to get rid a lot of code just two that comes to my mind quickly.
I agree with to 100%
+1
You speak well! I agree with you to 100%, and sincerely hope that we all in the Drupal community will listen to reason and drop support for PHP 4.
we totally agree ...
and have already announced that CiviCRM v1.8 is our last php4/mysql4 release. The next version 2.0 will only be php5.x / mysql 5.x which will allow us to use a few more php5 features. We do currently write in php5 (but omit a few interesting things) and convert to php4
yes, i think it would be great if the large open source projects stop supporting php4. A fair percentage of our users are still on php4 (35% or so), i suspect we will get flamed a bit for not supporting php4, but we need to / have to do it :)
lobo
I totally agree
I never really understood why it's imperative to stick with php4, after all if Drupal N goes php5 only and you absolutely need php4 you can still use Drupal N-1. Maybe those interested could provide security support for Drupal N-1 for an additional lifecycle.