PHP developers: wakey wakey!
I placed this entry under 'programming' but it might as well have been placed under 'rants' really. I've been programming PHP for over six years now. It's still definitely my language of choice because of it's speed, ease of use, ease of deployment and last but not least: because of the huge community with all of it's advantages. However there's one thing that's really bugging me lately: PHP is seriously suffering from what a friend of mine called 'the Apache syndrome'. Apache 2.x has been released a long, long time ago. Yet, tons of servers are still running 1.3.x and they probably will continue to do so for years to come.
While this isn't all that serious for a webserver (as long as it serves it's stuff and the server doesn't break it's fine) I believe the case is different with PHP.
Lately I have the feeling PHP's 'coolness factor' is diminishing faster than Ruby on Rails" gained this status. The main reason for Rails' success is it's advanced development paradigm: Model View Controller. Ruby on Rails forces pure object oriented application design in which the application is strictly divided into three layers: A data layer, a business layer and a presentation layer. Many developers (including PHP developers) are 'discovering' this style of application design through Rails. In short, Ruby on Rails is good news for the web development community. Finally we're moving away from amateurish script hacking into true object oriented application design.
All this stuff however isn't some sort of holy grail introduced by 37Signals. This way of working has existed for much longer. In fact it's being used in most professional software engineering environments. Java, .NET, Python, you name it, the pro's work with MVC and a solid OO architecture. Yet PHP seems to be unable to escape from the script hacking phase in many cases. Skilled PHP developers with solid understanding of OO design who are able to unleash the power of what PHP5 has to offer are extremely hard to find. For some reason, PHP developers seem to be stuck with version 4.x forever and ever. They're missing out on an astonishing amount of new features, better performance, superb new core extensions and last but not least: a mature object model. What a shame that is!
In November 2004 (yes, I kid you not) I already wrote an extensive article on the wonderful new stuff available in PHP5. With version 5.1 there's even more excellent stuff available. Let's walk through some highlights:
- private and protected variables
- private and protected methods
- interfaces
- unified constructors
- abstract classes
- destructors
- exception handling
These were just some features of the new object model. There's more!
- highly improved XML DOM support
- SimpleXML
- highly improved XSLT
- PDO, the new dababase abstraction layer
- SQLite
The list goes on and on and on. Then there's superb frameworks such as Symfony or WASP. There's so much exciting stuff available I haven't even been able to touch half of it. But I did touch the most important thing: PHP 5.x. Going back to version 4 feels like stepping out of a Rolls Royce to continue your journey with an old worn Chevy.
Therefore, PHP developers: Move your ass, port your legacy apps and start reaping the fruits of true web applications with PHP5. It will take some effort if your PHP4 code is of a rather messy nature but if you've been a good boy/girl while developing your PHP4 application it won't be all that hard. After this you'll be able to taste the goodness of PHP5. Do it, today. You won't regret it!
Yes, I know. You can do more or less robust MVC design in PHP4 as well, as long as you're thoroughly disciplined and as long as you 'fake' a lot of stuff you'd use automatically in PHP5. PHP5's object model is simply lightyears ahead of PHP4's one.
Filed under: programming, Rants
Number of comments:
Number of trackbacks:
Tagged with: 







At 06 February '06 - 12:52 Khevor wrote:
At 06 February '06 - 13:49 Max Roeleveld wrote:
If it ain’t broke…
Of course, the “PHP Apache2 doesn’t work because of threading issues”-myth doesn’t exactly help. I’ve been using Apache 2 and PHP 4 for quite a while, never as much as a hiccup, but a lot of folks are not willing to risk downtime, which is understandable, of course.
At 06 February '06 - 13:58 Bram wrote:
Too bad indeed that PHP keeps a bit behind on this issue…
At 06 February '06 - 16:56 Dewey Spencer wrote:
My hosting provider has recently rolled out ruby/rails, subversion, and php5. This past week I installed symfony and typo and I must admit that I am down right giddy.
It’s like Christmas with all these new toys. Now I just have to find some of that fabled “spare time” stuff. ;)
At 07 February '06 - 00:19 Marco wrote:
At 07 February '06 - 05:18 Simon wrote:
At 07 February '06 - 08:11 Cal Evans wrote:
The move itself wasn’t difficult but I had to then visit phpBB and other assorted programs, upgrade where necessary to get everything back working. The worst weren’t packages but custom written software. (ok, so a lot of it was mine personally!)
The pain of upgrading and the lack of incentive is probably what is keeping a lot of hosts from taking the 5.x plunge.
IMHO, etc.
=C=
At 07 February '06 - 09:11 Somekool wrote:
you must also not forget that Ruby is a mature programmation language (as old as java and python) and made by people with the goal of creating the best language ever.
At 07 February '06 - 10:11 Marco wrote:
At 08 February '06 - 07:50 Pieter wrote:
At 08 February '06 - 07:56 Max Roeleveld wrote:
Dude! You need to, like, switch to WordPress. It won’t make a difference about the PHP5 support out there, but at least you can put the post under both programming and rants. =]
At 08 February '06 - 07:59 Marco wrote:
And now…. ‘In je mand!’
At 08 February '06 - 23:17 Kyle wrote:
Though as for porting PHP4 apps, the problem inlies with the language upgrade itself. It’s not that it’s hard (there are very few changes that need to be done), but rather that people prefer not to maintain their apps at all. Sysadmins that switch to PHP5 would look like morons.
Here, is where I think it turns interesting: you’ve outlined one of the largest benefits of Rails. When Ruby changes, Rails can account for it (because Ruby is a dynamic language) and the end user feels nothing (A great example of this was the recent change to Logger). Try that on for size. ;)
At 09 February '06 - 01:11 Marco wrote:
If only I had the time I’d check out RoR more but I’m afraid it’s not going to be possible any time soon…
At 09 February '06 - 13:45 Kyle wrote:
With Ruby, it’s a dynamic language, and you could potentially rewrite the function from the ground up. This allows a framework to not only control the framework, but the language itself. PHP will never be able to do this.
At 10 February '06 - 08:43 Gijs wrote:
We’ve looked at Ruby but I find it too tricky to invest in a new language while I’m confident about LAMP and I can easily find more developers to work with PHP.
We do work on dedicated servers for all projects so we could choose any platform or framework, but i think PHP5 is the best option now for fast, high traffic consumer websites. We use a lot of XML to store and retrieve data, so i’m quite happy about its new features and performance.
At 10 February '06 - 09:14 Pete D wrote:
Pete
At 11 February '06 - 02:55 Dominique PERETTI wrote:
PHP5 syntax is quite ugly compared to ruby but it’s fast, rock-solid, and easy to deploy.
And one can write clean code with PHP5.
I’ve developed my own lightweight framework that somewhat mimics rails from the controller/view standpoint.
It uses Smarty for the views.
It is currently integrated into alahup! to let developers create modules but it will be released as a stand-alone package in a near future.
Read this to get an idea :
http://www.alahup.net/documentation/dev/..
At 13 February '06 - 14:48 Mike Papageorge wrote:
Hmm.. Just like poor html, seems that as long as it works, people will be getting into PHP at the script hacking level, no doubt.
I think the problem here lies in the fact that much of the PHP population is script hackers and dabblers. They aren’t going to push for PHP5, and the ones that do want the OOP glory, and need it and can use it etc, will be working in environments where they can employ it. Like my laptop
At 14 February '06 - 05:48 Tom wrote:
At 14 February '06 - 22:24 quocbao wrote:
But i still write my app in PHP 4 , because few web servers support PHP 5.
i think , if you want people using PHP 5, webmaster must upgrade his PHP version first :)
At 16 February '06 - 03:30 Veracon wrote:
At 20 February '06 - 02:47 Wim wrote:
Another provider where I have an account does not want to migrate to PHP5 , because of compatibility issues for his existing customer base.
I have PHP5.1.2 in my development environment but the transition was at first a pain in the neck because of the alterations made for e.g. the PDO extension and support for SQLite 2.8 databases (has be compiled in separately).
The language of choice for serious hackers back at the end of the 20th century was Perl. No buzz around this language anymore and they remain stalled at 5.8… Given the current development in PHP and the adaptation of newly released functionality , makes me think that the appeal of PHP will gradually fade away in favour of RoR, AJAX an the like.
In addition, when looking at the roadmap for future PHP releases, there is nothing overly exciting is in it for me.
What continues to surprise me in this whole discussion is the lacklazard way at which people implement security updates for both Apache and PHP. All incremental updates contain bug resolutions you actually need to have.
At 21 February '06 - 07:22 Nate K wrote:
I took the initiative to get serious with it and have developed the majority of my apps with OO PHP, even small frameworks for small sites. I have played with CAKEPHP and it was nice – just not exactly what I needed.
I have yet to dive into RoR, but am excited to check it out. I have only seen some videos of the backend, and played with the frontend of several apps. Will it replace PHP (as compared to PHP replacing Perl)...im not sure. I still think PHP has a good hold on many websites out there (as sad and hacked as some may be).
The MVC approach is what I use with my PHP code and it works great! It allows me to fix update things, without getting in the designers and marketers way.
So – in response to the actual article – I think it is the PROGRAMMERS who need to step it up a notch. I know not all have the availability of PHP5 – but seriously, it blows PHP4 out of the water. I would press to get it on your hosting account. (I am one of the lucky ones who administrates the webserver and can control the security).
Good article!
At 21 February '06 - 15:56 Jero wrote:
At 26 February '06 - 18:21 Jason Brown wrote:
I do however want to learn about advanced programming in php. Right now I am on php4 and would like to move to php5 and learn OOP and MVC styles.
Where on the net can I find a good place to learn this easily?
Pretty much my learning has been limited to reading a few ‘newbie’ php books and online at places like sitepoint.com. However these books and sites hardly help someone like me move to more advanced techniques like OOP, classes, MVC and other styles. If they do discuss advanced techniques, then it is geared to those already fimiliar with those advanced styles.
SO where is the middle ground? Most sites and booked are geared to newbies or very advanced techniques that require you to know about the subject already.
I have found it hard to find a good resource that walks into the middle ground area to teach someone the models and techniques past a beginners phase.
Any suggestions?
At 27 February '06 - 04:41 Marco wrote:
It will teach you how to ‘think object oriented’ and how the design process works. When teaching PHP I’ve found that people really need a conceptual basis before they can actually design any OO applications themselves. It’s easy to look at PHP examples that are object oriented but it’s very hard to create it yourself if you’ve never done that before. This is why I can highly recommend accquiring some basic UML knowledge beforehand.
After that you’ll probably be able to much better understand the OO tutorials you’ll find at (for example) zend.com and other places on the web.
At 28 February '06 - 06:33 Test wrote:
At 28 February '06 - 06:37 Marco wrote:
At 15 March '06 - 12:23 Rich wrote:
At 26 April '06 - 08:48 Nick wrote:
As a PHP-first developer who’s also used RoR to develop commercial apps, and dabbled with Symfony and Cake, I fell in love with the simplicity, flexibility, speed, ease of deployment and relatively ego-free world of CodeIgniter.
For those who are stuck with PHP4 but want to dabble with PHP5, Mediatemple have just announced that their new shared server package will allow you to specify which version your account runs, and it doesn’t need to be safe-moded. Worth a look…