PHP: the quiet powerhouse

It’s been very interesting beginning my trajectory in web development in 2012. I come to all of this at a time when PHP is no longer trendy and has caught flak in certain corners for quite some time. A lot of this probably has to do with the fact that PHP has been around for a while and (developers get bored easily) is now far from the only game in town for developing dynamic web applications.

Dozens of new language-specific communities have now entered the fray and brought along their legions of devotees with them, and many of those devotees see PHP as being passé. I even had the following happen to me, and this is absolutely a true story and can be verified by our VP of Operations, Richard Kotulski: I was in an elevator with O’Reilly’s very good “PHP Cookbook” in hand and an older gentleman scoffed at me and said, “PHP? What is this, 1920?” This really, actually happened. I doubt it would’ve have happened if I had had a Python or Ruby book in my hand.

I find it more than a little strange that PHP is simultaneously (a) out of fashion, and yet (b) absolutely everywhere. It powers an absolutely vast, almost cosmic number of websites. A few examples among millions: MediaWiki, on which Wikipedia is based, was written in PHP. It’s common knowledge that Facebook’s front end is written in PHP (although they now use the homemade HipHop to convert PHP to C++ on the back end).

What else? Oh, you know, Digg, WordPress, Flickr, and YouTube (originally). (Props to Jeff Atwood at Coding Horror for this list, though I disagree with the general thrust of the post in which the list is found.)

That should put to rest any doubts that PHP isn’t scalable. If anything, the onus is now on other languages to show that they can live up to the many already-existing accomplishments of PHP.

I also find this attitude toward PHP to be quite unfortunate. Why? Well, one reason has already been made clear: PHP does lots and lots of heavy lifting out there. It has more than proven itself.

But I also think that it might be the best language to use in gaining an understanding of the fundamentals of web development. This is my conclusion after spending some time with the same “PHP Cookbook” mentioned above and coding an app and deploying it on AppFog.

Now, let me warn you: this app isn’t exactly going to be garnering any awards any time soon. I put it together in a few hours having never touched PHP. But it nonetheless served as a fairly instructive introduction to aspects of PHP development.

I think PHP is the perfect language for beginning web development for two reasons:

  • Direct HTML embedding. There are now more options available than ever for rendering HTML, from ERB to haml to jade to EJS and beyond. With PHP, HTML rendering of the type that you would use in a Rails project, for example, can be safely side-stepped, because the language was simply built with the intention of being readily embeddable into HTML. <?php insert_code_here ?> is your one-way ticket to getting actual executable code into your HTML. This can be quite useful for apps at all levels of complexity.
  • Straightforward file organization. What struck me immediately is how different PHP development at the entry level is from what I had been learning thus far in Rails, Backbone, and node. Within these frameworks, a great deal of time was spent figuring out how to navigate through dense thickets of directories and disparate file types. Your typical Rails app, for example, is a many-headed hydra of Ruby files, YAML files, LOG files, and others (not to mention that you’re bound to use JavaScript and CSS, not to mention embedded Ruby, SASS if you’re so inclined…the list goes on).

For a simple app like the one I made, the barriers to entry in terms of knowledge accumulation were far lower than they were for Rails or node or anything else I’ve used. The distance between zero and producing something with functionality that involves sharing variables across pages, performing operations on those variables, and returning values elsewhere, was much shorter than it would have been using other languages/frameworks.

The other great thing about PHP is that although I did all of this using native code, there’s an absolutely vast range of frameworks designed to enable you to produce fully functional apps without having to do spend hours putting down boilerplate code in your text editor. AppFog, for example, offers direct support for a number of such frameworks, from Drupal to WordPress, with more on the way.

One last great thing about PHP: if you wish, you can use PHP without recourse to an MVC-style framework, as I did on my app. This means you can hit the ground running without learning to develop within a broader framework. But if your projects demands a level of sophistication that requires an MVC-style framework, platforms like Symfony and Yii allow you to do that, too.

No web development language outside of PHP grants you the kind of flexibility to both (a) produce genuine functionality from scratch, outside of an MVC framework, and also to (b) work within the bounds of MVC in deeply sophisticated ways if you wish.

In sum, PHP might not be the hottest thing on Hacker News or GitHub. But it is versatile, incredibly capacious, and more than worth considering for projects of all levels of sophistication.

Next week, I’ll share some of my experiences with deploying on AppFog. Until then, Dear Reader!

Share this post
Facebook Twitter Google
Try AppFog: The new PaaS Hackers love
  • Fisadev

    some things you should remember:
    (disclaimer: not native english speaker)* being widely used isn’t the same as being the better tool for the job. Cobol is still quite widely used, and you know that there are far better options. Some reasons to wide usage can be legacy code, easy to find developers, and such.* hate to php isn’t based on fashion or superflous reasons. Most people hates php because of well known reasons that make it a bad programming language that encourages bad practices. I don’t know any developer who *really knows*  php *and* python or ruby, and likes php more than the others.* embedding html in the code *is not an advantage*. It’s plain wrong, generates bad code that will be difficult to mantain, adapt, debug and understand. It’s easyer on the first write, but far more difficult later. Easy != good. Using goto can be easyer too, and it’s bad. Flask for example, is easy *and* good. Embedding html inside code, is easy *but* bad.

    • Josh

       I don’t know any developer who *really knows*  php *and* python or ruby, and likes php more than the others.
      I know Python, Node.js, and PHP. I prefer PHP over the others.

      • Pedro

        I know python really well, i’ve been coding with it for a few years and I still like PHP better. 

        PHP is the best language in a way that cannot be explained :) it’s weird. 

      • Samuel Levy

        I know PHP and python (and Java, and a smattering of a number of other languages), and I prefer to do most of my side projects in PHP.

        I wrote a blog about why about a week ago (here: but what it comes down to is this: PHP offers me quick development times, and less “messing around with frameworks” times when I want to get an idea out.

        If I’m building something bigger that I know will live for a long time, I’ll probably use some other language, but for most of my small side projects, PHP it is.

    • Eric Ingram

      For anyone who already knows PHP, it’s easy to pick up Ruby or Python or Node. They choose not to because they get a lot of value out of PHP.

      I prefer PHP over the others.

      • Anonymous

        If you do prefer PHP over the others, you haven’t really understood what Python or Ruby are about, and how using a more orderly and smarter language/platform can help you be more productive.

  • Fisadev

    wow, all the line returns were stripped away! -_-

  • Fisadev

    wow, all the line returns were stripped away! -_-

  • Fisadev

    wow, all the line returns were stripped away! -_-

  • Fuzz Leonard

    “No web development language outside of PHP grants you the kind of flexibility to both (a) produce genuine functionality from scratch, outside of an MVC framework, and also to (b) work within the bounds of MVC in deeply sophisticated ways if you wish.” 

    You do realize that MVC web development frameworks are built upon (a), right? Rails was not birthed whole, it was built on top of erb, which works exactly the way PHP does. Erb is to Rails as PHP is to Symfony. 

  • Anonymous

    In my opinion, direct HTML embedding provides convenience at the cost of good design. It’s a crutch until you learn how to do things the right way, which is to separate your concerns so that your markup is discrete from your logic. I would encourage beginners NOT to use it if you’re working on an app that you intend to be maintaining for a while. Embedding code in your markup is only good for beginners in that it quickly teaches you why you shouldn’t do it.

    • Guest

      “the right way” according to whom? Beginners just want to see things work. Its more fun that way.

      Doing everything the right way would have cost Facebook the critical startup time up front and allowed competitors to emerge, arguing over semantics and cutting edge vs getting it out there and getting feedback. This goes for almost every successful startup. There is always time later to go back and restructure and clean up or implement new ideas.Also, for someone totally new to development, you can’t just throw them at Rails or Sinatra and expect them to understand what is going on. Just go ask a newbie developer to get Ruby on Rails stack running on their local development (prior to the one click installer) before they could get MAMP or WAMP running.

      • Anonymous

        The right way according to software engineers that have been solving these types of problems for decades. There’s a reason design patterns exist. Most developers are not solving problems that haven’t been solved before, and therefore should rely on the wisdom of others.

        Regarding Facebook, I think you are assuming too much. I don’t know if facebook embedded logic in their views, maybe you have inside knowledge. The fact that facebook used PHP and became wildly successful honestly means nothing. It’s a single data point without context. Maybe they could’ve launched twice as fast in another language; there’s honestly no real way to know.

        I also do have direct experience helping folks that have never written a line of code get up and running with Ruby environments. It’s not as hard as you think, and expecting them to understand it is no more of a stretch than expecting them to understand a discrete web server and RDBMS. It’s probably easier to get going on PHP if you don’t care about understanding what’s going on behind the scenes. Is that good? Not in my opinion.

        • Eric Ingram

          I think you are assuming too much.

    • Kosher Samosa

      Direct embedding is a poor way to do templating. Type safe template systems exist; Facebook even designed a superior one for PHP (XHP) because string munging can’t be made reliable and provides no assistance in adhering to a schema. Another example would be Scala and its web frameworks which exploit fully typed XML literals.

    • Eric Ingram

      I think you too broadly describe HTML embedding. There is plenty of logic in templates, as templates without logic are not very useful. It’s important to discern between presentation logic (which is easy to maintain embedded in a template) and business logic.

      • Anonymous

        You are right, I should have been more precise. There is logic that belongs in views (loop through this collection and output these elements) and there is logic that does not (get collection:foo for user:bar). 

    • Luc Perkins

      You’re definitely right re: Sinatra, which is great and has already had an impact outside of Ruby. Wikipedia has a convenient list of Sinatra-inspired micro-frameworks:

      But I think that you made my point for me. “until you learn how.” That’s exactly the claim I was making about PHP for beginning devs. Before you go and learn a big framework that has a supervening logic subtending your rendered HTML, PHP is not a bad place to start. Even if you determine that you shouldn’t do things this way, it would be good to know why. That’s the long and short of the claim I was making.

    • Beavis

      View logic stays in the views otherwise you can’t build a dynamic site.

      Business logic absolutely belongs in the M part of MVC, but there has to be logic in the views

  • Ben

    “No web development language outside of PHP grants you the kind of
    flexibility to both (a) produce genuine functionality from scratch,
    outside of an MVC framework, and also to (b) work within the bounds of
    MVC in deeply sophisticated ways if you wish.”

    No language other than ColdFusion ;-)

    • Anonymous

      Obviously Ben Forta (?) clinging to a relic.

      • Kosher Samosa

        Does anyone really think PHP won’t be a relic in 15 years? Developers deserve better, and language design moves on.

        • Lucas Carlson

          After the first 15 years, PHP still makes up over 1/3 of the entire web. That is a HUGE incumbent interest. I do not think PHP is going away in the next 15 years.

        • Mister

          Like rails will be around in 15 years.  That’s a good one. 
          There are better languages that encompass MVC and better code design such as MS C# and .ASP but you have to give to get ya know.

      • Anonymous

        could be ben nadel too

    • Rad G

      Keep forgetting about cobol, eh?

    • Gscott

      I use asp classic every day with great results. Its too bad when I started php sucked so bad.

  • Yangsunwoo

    I started learning web development about 5 months ago and I only have one reason to use a certain language over another– It has a large and active/helpful community.  I started with Python/Django, but it seemed like the community wasn’t as active in making helpful videos/articles on the subject and I eventually switched over to Ruby/Rails.  Rails has a huge community of developers who are passionate about teaching what they know.  The rails community also has a large number of tutorial videos/articles that helps the ruby nuby start out.  I’m sure this hype will die out soon as another language is put on the spotlight, but those are the reasons why I decided to start with ruby rather than the other good choices out there.

    • Luc Perkins

      Agreed. Learning Rails has been thoroughly enjoyable for me, and there are some absolutely dynamite tutorials. I can see why it rocketed into the stratosphere for start-ups and others post-2005. I like Python as a language a lot, but learning Django has been mostly a non-starter for me as well. That will change in the future when I begin making more of a push to learn Python. In the meantime, friends have great things to say about the Flask framework for Python, which is a Sinatra-inspired “micro-framework.” If you want to stay on the Python track, you might want to have a look at Flask (and also at Sinatra since you’re already diving into Ruby).

  • Anonymous

    One of the main reasons PHP isn’t trendy anymore is because most developers find PHP boring and dull from a pure language perspective. This is understandable given that its BDFL (Rasmus) *hates* programming (

    If you look at other competing languages, like Python, Ruby, JS etc. You’ll find that the BDFL / committee responsible for growing the language is passionate about programming which is why they bring Fun into the equation.

    • Court

      I don’t mean to nitpick, but PHP does not have a specific “BDFL”. Rasmus created the first versions of PHP, continues to contribute to the language, and is generally well-respected throughout the community, but no one person drives the development or direction of the language.

  • Kosher Samosa

    Any critique of PHP should include this:

  • Rad G

    Direct HTML embedding: spaghetti code ftwStraightforward file organization: yeah, include and include_once FTW, why would you care about convention, also logs is unnecessary crust, who needs CSS and JavaScript files? use inline CSS and vbscript, why not
    Are you relly trying to make a valid point here?

    • Luc Perkins

      I think I DID make a valid point.

      Direct HTML embedding can be spaghetti-ish in the wrong hands. It can also be quite elegant. Rendering HTML on the basis of a supervening logic can also get very spaghetti-ish very fast in the wrong hands. Just because you’re using, say, ERB doesn’t mean that the result is crystalline.

      Second, I never said that you shouldn’t use log files or CSS or JavaScript. Why on Earth would I say such a thing. What I meant is that with PHP you can start making things that actually do things without learning how to configure routes.rb or how to import/export modules in such a way that you can make models work in Node, etc.

      And yeah, inline CSS is perfectly all right now and then. Use cases use cases use cases.

    • Mark B

      Who needs convention?!? My god…

      I shouldn’t complain; ‘developers’ (cough…) churning out crap for the sake of speedy delivery has kept my business growing for the past 18 months – not by doing the same, but by being called in to rescue failed projects built on the SSA (Scatalogical Scattergun Approach) principles extolled by Rad G et al.

      Keep it up! :-)

  • Martin Doms

    The ignorance is strong in this one. PHP is objectively a bad language. Yes, it’s widely used. Yes, there are a lot of successful websites built on PHP. No, this doesn’t make PHP a good language. There are real, objective reasons we don’t like PHP. It is poorly designed. It is flawed. There are better alternatives.

    • Meow • Japan & Urbex

      Javascript is objectively a bad language. Yes, it’s widely used. Yes, there are a lot of successful websites built on Javascript. No, this doesn’t make Javascript  a good language. There are real, objective reasons we don’t like Javascript. It is poorly designed. It is flawed. There are better alternatives.

    • Meow • Japan & Urbex

      Javascript is objectively a bad language. Yes, it’s widely used. Yes, there are a lot of successful websites built on Javascript. No, this doesn’t make Javascript  a good language. There are real, objective reasons we don’t like Javascript. It is poorly designed. It is flawed. There are better alternatives.

      • Meow • Japan & Urbex

        My modest contribution to the useful comments.

      • Meow • Japan & Urbex

        My modest contribution to the useful comments.

      • Martin Doms

        Uh yeah, no kidding. You won’t find me defending Javascript – it’s rubbish. There are good languages and there are bad languages. PHP and JS are definitively in the latter category. The only major difference is the last point – there really aren’t good alternatives to JS at the moment.

      • Anonymous

        I beg to disagree. Javascript has its ugly parts, but there are also good parts about it.

        For one, it’s highly functional – provided you know how to use it. – the guy knows more, is a better speaker and is smarter than I am.

    • Samuel Levy

      Yes, there are faults with PHP. This doesn’t make it a bad language.

      The reasons mentioned in this post, however, are what makes PHP a good language. It’s not about the beauty of the code, or how logically functions are named, or how well the Object Model stands up to the Object Model in Java, or C++, or any other language.

      It’s about utility.

      Having the coolest features doesn’t count for shit if you can’t use them when you need them. Having “objectively better” code doesn’t count for shit compared to “code that’s running, right now”.

      Are PHP projects, generally, a mess? Yes, most of them are (but it’s not impossible to write clean PHP code). Do other languages force better coding practices? Most of them do (but it’s still very possible to write unreadable mess in any other language). Can you get a project running as soon, with as little screwing around in any other language? No.

      Where PHP excels, and the very thing that makes it a good language, is that it fits into a niche that comprises most of the small business on the web, and that all the other languages refuse to touch in case they are considered “dirty” too. It puts dynamic web sites within reach of small businesses, and can scale up to large businesses as required. No other languages can even hope to meet the range that PHP has.

      And finally you say “there are better alternatives”. No, for most small businesses, there are no alternatives.

      • Martin Doms

        “And finally you say “there are better alternatives”. No, for most small businesses, there are no alternatives.”

        Like I said, ignorance.

        • Samuel Levy

          OK, what is an alternative platform for setting up, say, an e-commerce site for a small business with little-no previous tech experience? What would your budget be? What about hosting? How much would extra development cost, and how easy would it be for them to find a new developer?

          This is what I’m talking about; PHP offers a low barrier to entry for small businesses. It offers them low costs for set up, low costs for support, and low costs for future development. It does all of this better than any other language because PHP, as a language has a lower barrier to entry for developers.

          I’m not saying that PHP is the best language for everything. For many things, it’s down-right horrible, and I would much rather be writing python or Java. For a small business that has a low budget, though, PHP gives them what they need, fast. It’s an added bonus that, as their business scales, they don’t have to throw everything out to make their web presence scale.

          • Kenneth Love

            You do realize that “lower barrier to entry for developers” means PHP devs don’t have to be *good* devs? That’s not a positive point.

          • Samuel Levy

            Aah, so you’re one of the magical developers who started programming and was instantly brilliant at it?

            Yes, I’m aware that it means PHP devs don’t have to be good devs, but there’s nothing that says a Java dev, or a python dev has to be any good either.

            The point I’m trying to make is that the reason why PHP is good is because it solves a problem that no other language does. It makes it easy to start, develop, scale, and deploy projects without having to understand frameworks, objects, or any of the “high-level” programming concepts.

            When python, ruby, or java get to a point where you can just write a single file, throw it in a folder on a server somewhere, and you have a working application (without having to know about frameworks, libraries, importing, etc.) then we’ll be getting somewhere.

            Yes, PHP is flawed. Yes it tends to breed shitty coders (although it’s not the only language that does). But it gets the job done with the minimum of fuss.

          • Kenneth Love

            No, I wasn’t amazing at all. Hell, I’m still not amazing. Go find a low-intermediate developer that says they suck. It’s hard to find because of the Dunning-Kruger effect[1]. PHP’s low barrier to entry often means that *these* programmers, who know just enough to be dangerous, are the ones writing software, maintaining projects (often by other mediocre devs), and working for small businesses (who has been listed as a major benefactor of PHP and it’s low barrier to entry).

            This results is more and more bad practices, implementations, advice, and code in general.

            Developers who work in a more structured language seem to not have that same sense of…ability…so soon. Yes, it’s harder to find Python or Ruby or Scala devs, but the ones you do find are usually much better at their craft and less overconfident than the typical PHP dev you find in places such as oDesk.

            This isn’t about PHP being flawed, per se, it’s about the low barrier to entry. Javascript suffers from the same problem. No language is perfect, either, and I’m not implying that they are. But a low barrier to entry is *never* a point in favor of a language or framework. You should have to work for your knowledge and ability.

          • Mister

            >PHP’s low barrier to entry often means that *these* programmers, who know just enough to be dangerous, are the ones writing software, maintaining projects (often by other mediocre devs)>

            So what do you care?  Are you the patron saint of all small business or something.  Your concern is touching…but when will you focus on feeding the hungry?

          • Martin Doms

            Maybe he “cares” because this whole fucking post is about PHP and that’s what he’s discussing.

          • Rad G

            Node gives you this ability.
            Also, your point about low entry and small shops (previous comment). Lets say I’m a tiler, no experience and you have a small house, I’ll do your bathroom, kitchen, pool, whatever you want and I have no clue what materials to choose and what the effect is going to be. For sure you’ll have tiles somewhere in your house. Deal?

            This is basically what you’re suggesting with PHP and low entry barrier. Those who start with PHP hardly move to other technologies because they can’t be bothered.

          • Luc Perkins

            No, Node does not give you this ability. It does give you the ability to specify the entire logic undergirding your app in one .js file, but you can’t specify your HTML templates there (as you can in Sinatra). This is true even if you’re making a one-page app, which Node is well suited for.

          • Anonymous

            You asume you absolutely need to use templates, don’t you? Well, that’s wrong. You can very well build an entire sales site without a bit of manually crafted HTML or CSS, and still make it look good.

            There’s nothing you can do with PHP that you can’t do with JSP. JSP scales better than PHP. It’s similarly fast to write and deploy – and similarly ugly and bad.

    • Joseph Dotson

      It’s not about how flawed the language is. All languages are flawed in some way. PHP is simply less costly to develop in than most other languages. It also happens to be rather scalable. That I believe is the sole reason people still use it. The development tools for PHP are literally zero cost. The server setups require minimal knowledge of apache, much less than someone setting up something like django (and doing it properly).

      • Anonymous

        It’s indeed cheap to develop in PHP. It’s expensive to maintain and run it.

        IT isn’t the only area in which especially smaller companies do the mistake of buying  solutions which require smaller up-front payments, but are more expensive in the long run. The companies not having this bad habit are called successful.

      • beavis

        How much does development tools cost for Django,Python,Ruby,Ruby on Rails, Sinatra, Perl, Seaside, node.js, Java, Erlang, etc, etc, etc

        Literally zero cost.

        Anyone with minimal knowledge of setting up a web server properly should not be setting up web servers, just like people with minimal programming knowledge should be producing public facing code.

        If you choose to use PHP in this day and age you don’t know enough to be trusted and shouldn’t be programming anything that will be publicly accessible.

        PHP on a resume gets instantly shredded.

    • Luc Perkins

      I think “ignorance” is a wee bit excessive here. I don’t lack knowledge of alternatives. I’m crazy about Node, for example. I’m not someone who has used nothing but PHP since 1995. My claim was merely that PHP needn’t be overlooked in a variety of scenarios. There are better alternatives for lots of things, absolutely. 

      And I’m not sure what an objectively good or bad language would be. That doesn’t mean that all standards should be obliterated. It just means that we needn’t paint languages with an eternal mark of Cain.

      • Anonymous

        PHP is like cheap, trashy products. It does have its usefulness, since it’s being bought into, but that doesn’t make it a good language or platform.

    • Enkdoo

      those are dogmatic assertions without saying what is ‘flawed’, why it is ‘poorly designed’ and which are ‘better alternatives’ and why.

  • Antony Wu

    I don’t think it is fair to call developers bored easily with PHP. I came from .Net background, and started with PHP development two years ago. I am definitely not bored with PHP. Instead, I just hate it with a passion. Its ugly syntax and wacky structure just blew my mind just how PHP was poorly planned since its inception. Had the creator put in some thoughts in the structure and design, PHP would be a far more enjoyable language to use. I do want to migrate over to Ruby as the design is far more superior. Working with PHP can really make a grown man cry and cuss on the floor. That’s not to say that Ruby is the solution for all, given that it has been under the weather with SQL injection bugs as of late (What is the with all the RoR hotfix and patches as of late?). Still, I can remember Ruby syntax far easier than I can with PHP (And that’s with two years of experience with PHP)

  • Nilesh Jethwa

    I am glad I chose PHP. In the business of selling software this is always going to be a winner for a long time. It is total different ball game when you try to sell software that can be deployed on customer’s premises. 

    (everything i built so far is PHP and java infocaptor , mockuptiger, old school? doesn’t matter)

  • James Jackson

    I use php all the time. I love it. Lic is right, in my opinion. The only thing that matters is making apps. If they work & are well written (from the stand point of being understandable by others or in the future, not if it’s MVC or not) it really doesn’t matter what language it’s written in. In a few years Rails will be fround upon.

    • Luc Perkins

      This is true. Some already see Rails as being “superseded” by Node. Well sure, if I’m making a single-page app involving web sockets, then of course I would use Node instead of Rails. But as in everything else, it all depends on use cases. I wish I could shout it from the mountaintops!

  • Eric Ingram

    I have been using php for ~13 years and it strikes a great balance for me. The most valuable part of the ecosystem has been the fantastic language documentation and knowledge communities. Finding an answer for anything is incredibly easy.

    I think certain types of people get so hung up on whether this or that language is better. They have too much focus on the language and not enough focus on the product. PHP has been the foundation of some of the most successful projects in the world and I am proud to have found my own success with it over the years.

    PHP, Python, Ruby, Javascript, whatever, just pick one and build something great.

  • Aalaap Ghag

    Thank you for saying what I’ve always believed in, but refrained from saying!

  • Guest

    It is about good practices that will save you time, and community.

    I made my first php app using tutorials and resources on the web. I devoted an exhorbinant amount of time to basic development and maintenance of the site.

    I made my first Ruby app using tutorials and resources on the web. Development and maintenance was a breeze.

    The difference was that the Ruby resources cultivated by the Ruby community emphasized conventions and practices which are objectively good because they save me time, and the php resources didnt.

    Could I have used good practices to write my php app? Of course. But I didnt. I did with ruby, so im a ruby developer. That is how it happens.

  • Pew

    A language is a tool and once you know how to use it properly you can do pretty much anything with it. If you can’t use a tool properly that’s not the fault of the tool – the fault is yours. PHP was designed to cater for the web long before even the most rudimentary web apps came into the picture. Since then it’s evolved and broadened to do far more than that and it does it well although it might not be the best for all situations and circumstances. It’s brilliant. The fact that it’s still around after so many years, has a massive community which is helpful and it is continuously being enhanced and improved shows this.

    I’ve written code in all sorts of languages over all sorts of platforms and when it comes to web development PHP is always my first choice unless it’s a large system in which case I switch to the best overall language for the platform like .NET for Windows, etc. ASP/MVC isn’t as flexible with the markup as PHP but a fully integrated system in all aspects is hard to beat. Python I dislike because of its style but Perl is a pleasure to work with and I like it too – it’s all about preference, style, platform, ability, community and exposure.

    One thing though, saying PHP is rubbish is the same as saying C++ is rubbish, do so at your own peril and know that you’ll never be a true coder or understand what coding really is… either that or you still need a lot more experience and maturity in development before you see the light.

    PS: Embedding code in markup is one of the best and most useful abilities of any web language and it’s part of what defines one. Dynamism and embedded code in markup go hand in hand. It can be abused but so can anything. Dynamically building page content based on previous inputs and state makes a lot more sense than scripting massive markup dumps and it also introduces meaning to the calls as well. It can also add one or two layers of extra security that wouldn’t otherwise be possible.

    • Paul

       “Embedding code in markup is one of the best and most useful abilities of any web language”

      Only in small scale projects, or when done with great care in very limited scope.

      “It can be abused but so can anything.”

      Once the project grows it is almost impossible to *not* abuse this ability with such joys as copy-pasted logic duplicated in scattered places throughout the code base. Maintaining that gets really old, really fast and tends to engender ill-feeling toward the language which permitted it to be done at all.

  • Hillbillywhore

    apple f “php unit” no results… 

  • Jeff Williams

    You’re comparing apples with oranges here. PHP is a language, comparable with Ruby. Rails is an MVC framework, comparable with something like CakePHP. I’ll grant you that PHP is the king of being able to throw up unstructured source files and making something run. In terms of a maintainable project though, this is not necessarily a good thing.

    Try taking one of your simple apps in PHP that has grown over a few years and:
    – migrate to a new host. I have done this several times and it is always painful. Database connections and hardcoded paths all over the place.
    – get a HTML designer to update the layout of the site. Good luck finding all of those embedded HTML snippets.
    – get new developers to work on the project and determine where business logic, presentation logic etc are located.

    So as you say it is easier to get something running quickly on pure PHP but harder to maintain. I would say that whatever the preferred language, there are advantages in having the structure of a framework, with relatively small up front costs.

  • Lee

    ASP/VBScript all the way

  • Julien Desrosiers

    I completely agree with you.
    Simplicity is great. Even if it means that less experienced programmers can make bad things with it. Some really good code is being done with PHP these days.

    • Luc Perkins

      Indeed it is. Thanks for stopping by. Let me know if you want to to hear more about PHP in the future.

      • Julien Desrosiers

        For sure! I found your post on , which i’m always reading.

  • webxtech

    thanks for the great post…

    • Luc Perkins

      Thanks a lot!

  • Phil Sturgeon

    I posted something similar the other day as an answer on Quora ( so this answer is just going to be fun instead.

    Developers love to chase the newest, least mature, least documented and least blogged about framework. It lets them send in pull requests and say “there I fixed it”, and lets them write the very first blog posts about how to integrate foo with bar.It also means they can write the first and most used package, meaning they can be big famous rockstars.If people don’t keep switching languages then how is that possible? The language that everyone uses would become full and nothing would be new.Everyone wants new and shiny, but some of us have work to do. PHP lets me get things done for my clients. I can write code and hand it off to their dev teams, I can build an application that works anywhere without hassle, and generally means I have the biggest market. Who cares if it’s not as cool as Rails? I am a proficient Rails developer but I don’t own a leather jacket, so they’ll never let me in their club anyway.

    • Luc Perkins

      Awesome. Loved this comment. I’ll admit that I’ve dabbled quite a bit in “cool” new things, so it’s not like I’m impervious to the influence of blogs and GitHub. But you’re absolutely right about how the playing field works sometimes. There’s always such a profusion of new things that there’s rarely even the time to step back from the fray and ask deep questions about what really works and what is ultimately just smoke and mirrors. Several times a week I’ll check out a new JS library that looks super cool and has a great logo and a write-up in Hacker News and I come to find out that it provides me little new functionality above and beyond what’s already available. Happens all the time.

    • Anonymous

      Actually, the trick to getting let into the Rails club is the skinny jeans. I didn’t have skinny jeans, a fedora, or unkempt facial stubble. But now i do, so they let me in the secret headquarters. I can now write these really cool, beautiful, inscrutable one-line statements that took me 4 lines in PHP. I can’t debug them, or remember what they do at first glance — but fortunately, I often have 10 lines of comments that explain how cool & awesome that incredibly efficient line is. The only trouble is, i have this nagging suspicion I’m becoming a sanctimonious douche who loves the smell of his own code/farts. It’s definitely worth it, though, to be in the club. I’m glad I’ve left the hoi polloi behind…

  • Fred The Kat

    Ah, another ‘My Language Can Beat Up Your Language Post’. Never saw that on the internets before.

    • Luc Perkins

      But this is clearly not what I was saying. I was defending a language against its many detractors and portraying it as a still-viable option in the web dev field. I have no interest in playing the better-worse game.

  • Matt Pedley

    PHP is great because it just works.  It’s a great language because of the way it works, it puts the onus back on the developer to understand the potential pitfalls but bad devs don’t make a language bad.

    At least PHP has a purpose, unlike Node or any of those “compiles to Javascript” languages that come out every week.

  • Paul

    PHP has large market share because of cheap, widely available hosting and because for a while it was a straightforward non-cost way to get a dynamic website up and running. This is no reflection of how good or not it is, it merely shows how accessible it is. BASIC was very accessible back when I started coding, but it was a lousy language in most of its implementations.

    One of PHP’s major strengths is that it allows “quick and dirty” solutions to be thrown together. That makes it good for getting some sort of functionality up and running in a hurry. That’s great if all you need is a quick temporary solution.

    But that strength is also a significant weakness. Quick, hacked together solutions rarely scale well and have a tendency to be damned near unmaintainable. Doubly so when they’re implemented by someone who has no concept of good design practice at all. Double-double when combined with some of the more notorious and well-documented problems with the language itself.

    I’ve been working with one such application recently and while it “works” the source is a morass of spaghetti code with some PHP embedded in HTML markup, some HTML markup being written out from inside PHP code, duplicated code in multiple .php files because they needed the same functionality in various places and chose to simply cut and paste instead of doing it properly, code which doesn’t ever get executed and a multitude of other general design issues.

    I know, the real WTF here is actually that the code was written in rush-order time by an inexperienced developer. But the related WTF is that PHP allowed them to get away with some truly bloody awful development practices, the sort of badness which many other languages could have prevented entirely and without taking a significant hit on the development timescale at all in a project of this size.

    The ability to mix markup and code freely has led directly to many of this application’s deep-rooted problems. This ability is only a strength if you never scale much beyond a very simple site. Once the complexity level rises a little it becomes a liability.

    In the end, PHP is a tool. Use it wisely and with awareness of its issues, strengths and limitations. It is NOT the One True Language (there is no such thing). Spend the time you would defending it against the unbelievers to instead make better applications which demonstrate how good it can be in the right hands. Good code makes a much more convincing argument, bad code just makes the language look bad and there’s an awful lot of bad PHP code out in the wild. If the application I’ve had to maintain is any way typical it’s no wonder PHP is so reviled.

  • Anonymous

    Don’t mistake the wide-spread usage of a tool for the tool being good. Fact is, most of the customers who get their sites done in 2 weeks through a cheap PHP coder, are touched twice a year, never improved, use outdated libraries etc. So go 10 years in the future (today) and you find yourself staring at a WWW which has a dropload of old, cheap and badly coded PHP websites.

    This is not, by any measure, a good way to judge the quality of the language, or its Web frameworks. Which is a mistake your post does — fact is, most of the experienced (and thus objective) coders will tell you that PHP isn’t any more flawed than many more languages. Yes, Java is “better” than PHP, but its Web frameworks are much worse than even the oldest of PHP’s. What makes a programming language a nightmare to use these days are his Web frameworks.

    So what you did in your post is: provide statistical data on something most of us coders already know full well. Grats. ;)

    I am happy that you found PHP a language good enough for certain goals — which is true, by the way. There are no “bad languages” per se; there are only languages / tools / frameworks which are *not* good enough for a given task. Simple as that.

    • Luc Perkins

      Agreed. The WWW is loaded with junk, but it’s junk built in a whole plethora of languages. In terms of sheer numbers, you might be right that PHP has produced more junk than other languages. No objections there. Its user-friendliness (for beginners at least) could be partially to blame for that. Hard to tell.

      And as for your last paragraph: that really says it all! Thanks for weighing in.

  • Mark Hayden

    “No web development language outside of PHP grants you the kind of flexibility to both (a) produce genuine functionality from scratch, outside of an MVC framework, and also to (b) work within the bounds of MVC in deeply sophisticated ways if you wish.”

    *cough* *cough* Perl *cough* *cough*

    seriously Perl does the above and some might argue it does it better ;-)

    (fun fact: PHP started off as a library of Perl code–“Personal Home Page toolkit”–before being translated to C.  Much of its syntax was inspired by Perl)

    • Luc Perkins

      That’s really really interesting. I’ll have a look at some of the history on this. Thanks!

  • No

    I work eith plenty of languages, and PHP was one of them, but recently I’ve been concerned of how many flaws it has and depending on the environment configuration, an app can break so easily. I can have 2 installs exactly the same that behave differently. that is a portability nightmare!

  • Sean Lars Ganser

    PHP rules.  

    I love all the Python and Ruby fan butthurt. 

    In the end, it doesn’t matter as long as the product is awesome and secure, no?

    • Luc Perkins


  • Ajibz

    Nice mention of Yii Framework

  • CMike

    PHP and JavaScript: have two languages — on which much of the web relies — been more maligned?

    • Luc Perkins

      I sincerely doubt it :)

  • Josh

    PHP is great. You can write very complex code with a few lines. Furthermore, with my setup, I have a server with 65ms ping. It takes 170ms to generate a forum page and send the data back to me. So with the 130ms latency subtracted, that’s only 40ms for the web server to kick into gear and get PHP to generate a pretty advanced page with 6 database queries. All with a server load of 0.01 even if I hold down F5…. God damn, I love PHP :)

    I am proficient in PHP and I use this language. Using bash via proc_open, there’s nothing you can’t do on linux.

  • Anelie Ivanova


    Recently I came across some great articles on your site.
    The other day, I was discussing ( my colleagues and they suggested I submit an article of my own. Your site is just perfect for what I have written!
    Would it be ok to submit the article? It is free of charge, of course!

    Let me know what you think
    Contact me at

    Anelie Ivanova

  • Rakesh Mehta

    I’ll not argue on whether PHP is bad or good one. I’ll just say, it is not a “barriers to entry” . Young developers find it charming and excited writing codes in PHP and this attraction towards programming encourages them to learn more sophisticated languages in future. If you were not taught the basic algebra and presented with calculus, what would be your reaction? Probably you would go away from maths :)

    Bye the way, PHP 5.4 has improved a lot and I tried to put some of the newer things here

  • arnoldgarrets

    PHP contains number of features which are proven to be useful for developers. It accepted by all and much easier to use.

Powered by Olark