10 Reasons why PHP is still very much alive

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

PHP

I have recently come across quite a few articles about the current state of PHP. The current situation does seem, on one hand, quite bleak. We know that the current install base of PHP 5 is still only around 17% and it does not look like that will suddenly increase. We could have a state of affairs that PHP 6 comes out and a large proportion of the servers out there will still be using PHP 4.

So what will be the tipping point that suddenly forces all those service providers to offer PHP 5 support as standard? Well first we need applications that are written specifically for PHP 5 that everyone needs. But the problem is that the current spate of popular products Drupal, Wordpress, etc. all can run on PHP 4.

Education
The only route out of this self fulfilling prophecy is education. We need to first educate all PHP programmers that writing in PHP 4 is only going to hold back the language. And that secondly there is a whole world of new features and ways of doing things that are simpler, slicker and more up to date than ever before. I include here a non-definitive top 10 things that a PHP programmer should know about.

1. Classes
Since PHP 5 we now have real classes that allow abstraction, reflection and even type hinting. Although not perfect the class model now being used means that every PHP programmer no longer has an excuse not to use them.

2. Magic Methods
You think Ruby is clever with its everything-is-an-object, well PHP with its Magic Methods gives you the power to make your objects do ‘anything’.

3. Exception Handling
Since PHP 5 we now have exception handling. If you’re not using any exception handling then first read this at wikipedia then go read the PHP documentation. And then go start using them!

4. Database support
Things have moved on a lot from PHP 4 and ‘mysql_fetch_assoc’. The PDO gives a lightweight consistent interface to your database. If your still using PEAR::DB (yuck), ADOdb or dba - then its time to move on.

5. Acceleration support
Need more speed? Then there are plenty of commerical or non-commercial solutions. Speed increases can be up to 5x.

6. Frameworks
My favorite topic at the moment, Frameworks. Do you need one? Yes! Can you write one yourself? Yes, but with so many quality frameworks out there you should be using one of them. A framework is more than just an MVC but at its core the MVC is what helps you keep organised. Here is why you should learn to use PHP in a MVC style. As you will see from my other articles, I’m using the Zend Framework but there are many popular frameworks:

7. Platform Support
Although this costs money the platform cannot be underestimated for the benefits it brings. Integrated error tracking, performance management, enterprise scalability. Any good PHP programmer should at least have a development version of this running.

8. IDE’s
PHP has a very rich selection of very decent IDE’s to choose from.

9. Debuggers / Profilers
Most of the above IDE’s come with debuggers. But there are plenty of others to choose from.

10. Support
PHP has vast amounts of support out there. From sample code, tutorials, testing frameworks, forums, PHP clubs and much much more.

If you have any comments/suggestions on other ideas that I could add to this list to help educate please get in contact.

I would like to thank Joe over at Obscene Art and Chris at @TheKeyboard for giving me inspiration to write this post.

There Are 20 Responses So Far. »

  1. Just a note on CakePHP - it recently won the SOEmoz Web 2.0 awards (http://www.seomoz.org/web2.0) for the Web Development and Design category, beating other competitors in the area, including RoR - Symfony and Zend didn’t even get a mention!

  2. I think it is a bit early for Zend Framework to be judged, although its MVC is not very mature, it does have a whole lot other fantastic libraries. As I have stated before ‘framework’ seems to be too closely associated with MVC for most people.

    CakePHP is very definitely more mature, (and I do like it!) but number one reason for me not using it (and one reason why it is so popular), is that it is PHP 4 compatible. The Zend framework extracts every ounce out of the current PHP 5 capabilities and is therefore the future in my eyes.

    Although I sound like I am defending Zend (I am using it!) I encourage everyone to try out all the most popular frameworks (time permitting) and see what you feel comfortable with.

  3. I think the manual is worth a mention. It’s one of the best manuals I’ve seen for an open source development language (not including extension development, but that is being sorted).

    You missed out the most excellent mailing lists from reason 10. After failing to find the answer in the manual and by searching Google it’s the next port of call for getting help. However, make sure your question demonstrates that you’ve done some research on your own first.

  4. Okay, this is just my humble, admittedly biased opinion, but the Zend “Framework” is not a framework. See here: http://cake.insertdesignhere.com/posts/view/18

  5. Cake is PHP4 compatible, yes - but if you choose to develop using PHP5 you will find that Cake works much more effectively with that. It’s due to go PHP5-only at some point in the future, but for now I agree with the developers that still supporting the older platform results in greater take-up of the framework, without any severe detrimental effects.

  6. Ok, (cough) you guys arnt helping convince me further of Cake when both your sites are built on cake, and are both giving errors :(

    If you were using Zend Framework, you would have dual .INI files that define the Exception handling differently for live and for development, so you dont have these embarrassing errors ;)

    Only kidding, am sure Cake has something similar, but you really should fix them :)

  7. Nick Halstead’s Blog: 10 Reasons why PHP is still very much alive…

  8. [...] his blog today, Nick Halstead has posted what he considers the top ten reasons that PHP as a language is still around: I have recently come across quite a few articles about [...]

  9. I know of six projects now, which are working on a PHP4 to PHP5 refactoring:

    The Typo3 refactoring project has been announced in October 2006: http://typo3.org/teams/50-development

    Jaws (http://www.jaws-project.com/) is even doing a PHP6 “refactoring” project in the GSoC under the PHP umbrella.

    Streber-pm (http://streber-pm.org/) originates from a refactoring efforts of phpCollab, netoffice and mantis.

    Geeklog (http://www.geeklog.net/) seems to me to solve exactly the same problems like Jaws. Geeklog has two projects in the GSoC regardign Geeklog2, which will be PHP5 only.

    Horde GroupWare plans to make use of PHP5 exclusive features in Horde4 and refactor at least parts: http://wiki.horde.org/BCBreakingHordeIssues

    eZ Publish is outstanding from this list, because they make a commonly useable library out of it’s refactoring efforts. (eZ Components). I think it’s also worth mentioning eZ Components in the frameworks list. They provide you with many components you need for web applications.

    I’ve been working in the eGroupWare project for a while and refactoring PHP5 was a very hot discussion some weeks ago. I believe, that there will be either a refactoring or a fork in the next time.

    Any other project somebody knows?

  10. Hey Nick,

    I find it really interesting (and a bit worrisome to my thesis that everyone building distributable apps ought to be developing in PHP, if they want them to be popular) that things look so grim for PHP, and uptake of modern versions. That makes me think maybe I’ve been missing a tidal shift, and in fact PHP is dying. Probably not the effect you intended. ;-)

    At some point, another language and platform will take the throne of “most popular”, but I don’t see any evidence that anything is poised to do so. PHP took the throne from Perl a few years back, because it was easier to integrate, easier to make go fast, and already had database access built in (versus Perl needing CPAN modules). It also was its own templating language, while folks had to install Mason or similar to begin doing anything like it in Perl…of course, PHP folks eventually realized that it’s nasty to mix business and presentation, but not before everybody had emulated it…so now PHP has pretty much caught up with Smarty, but it’s one area that PHP had “built-in” that has to be installed separately. New barriers to entry to use new techniques…the more those appear, the more likely folks will choose something else.

    Anyway, the current contenders are complicated to deploy, and history tells us that’s a near guarantee of failure. Ruby on Rails is pretty popular right now, but it has some issues that I suspect are fatal (while being a better language in every way than current PHP). But, before working with RoR, you have to install a dozen or so packages in addition to the language itself. And, of course, most hosts don’t support it yet. But, if, as you say, most hosts don’t support PHP5 yet, it makes the odds of Ruby toppling PHP look a little better.

    Interesting, regardless. I still think PHP is the best choice for applications that you want folks to install, but I wouldn’t pick it for a hosted application. But it sounds like maybe the shakeout and decline of PHPs popularity is just around the corner. Not what I though when I wrote my post on the subject a few days ago (I’ve been forced to do a lot more reading than I intended, since it garnered so much attention).

  11. nate, I can’t understand, why you cake-php-and-symthony-guys always mix up ideas of Application Framework and Architectural Framework, while sputter about ZF.

    CakePHP and others are Application Frameworks, but Zend Framework is an Architectural Framework and it is it’s goal and idea.

  12. Seems to me that a lot of non-programmers are currently deploying web sites in PHP.

    “The only route out of this self fulfilling prophecy is education. We need to first educate all PHP programmers that writing in PHP 4 is only going to hold back the language..”

    There is a lot you CAN do using object oriented methodologies, oo design patters etc…but all these will not be used because someone is going to tell people to use them. Experienced developers who can take full advantage of the OO techniques need a framework that allows them to build them.

    Start making php more appealing to experienced developers who can actually build large scale php applications for the public or the enterprise. Maybe then you will have “applications that are written specifically for PHP 5 that everyone needs”.

    Maybe the zend framework is a step towards this by offering components that allow the rapid development….The world needs to see php5 applications and understand all the benefits of the OO in the application development lifecycle before they start to use it…but again you need to talk to developers who can understand all these…

  13. Sounds to me like most of these 10 reasons are done better in .NET if you have the money. But what do I know?

  14. “We need to first educate all PHP programmers ”
    Darn right!!!

    I am tryng to learn php and cannot find a course anywhere to do it with!!

    How do php programmers get trained? In secretive organizations like the masons?

    Where can we get some intensive courses on PHP to get hobbiests up to speed on the language.

    Its VERY frustrating.

  15. @5. Acceleration support
    wonder why php people didn’t built PHP with one of these cache, they should.

    and most of the language feature is php5 feature, I’m expecting a php4 feature, anway, good articles.

  16. [...] 10 Reasons why PHP is still very much alive Classes, Magic Methods, Exception Handling, Database support, Acceleration support, Frameworks, Platform Support, IDE’s, Debuggers / Profilers, and Support (tags: PHP) [...]

  17. [...] LINK [...]

  18. The major reasons PHP is “very much alive� are the ease of development and the numerous applications available for it.

    Sure, as a programmer Wordpress looks like a pile of shit. But as a user, it’s really hard to beat.

    Same goes for nearly everything else.

    Think about it.

  19. [...] Make Your Web Site Better 160.  41 Simple Tips to Help You Get to Sleep 161.  10 Reasons why PHP is still very much alive 162.  Top Five Reasons Your Skin Needs You to Stop Smoking Now 163.  Your First [...]

  20. [...] you Can do Right Now To Make Your Web Site Better 160. 41 Simple Tips to Help You Get to Sleep 161. 10 Reasons why PHP is still very much alive 162. Top Five Reasons Your Skin Needs You to Stop Smoking Now 163. Your First Year of College: 25 [...]

Post a Response