Does PHP Have A Future, Or Are Twenty Five Years Enough?

In June, 1995, Rasmus Lerdorf made an announcement on a Usenet group. You can still read it.

Today, twenty five years on, PHP is about as ubiquitous as it could possibly have become. I’d be willing to bet that for the majority of readers of this article, their first forays into web programming involved PHP.

Announcing the Personal Home Page Tools (PHP Tools) version 1.0.

These tools are a set of small tight cgi binaries written in C.

But no matter what rich history and wide userbase PHP holds, that’s no justification for its use in a landscape that is rapidly evolving. Whilst PHP will inevitably be around for years to come in existing applications, does it have a future in new sites?

Before we look to the future, we must first investigate how PHP has evolved in the past.

The Beginnings

Rasmus Lerdorf initially created PHP as a way to track users who visited his online CV. Once the source code had been released and the codebase had been re-written from scratch a sizeable number of times, PHP was enjoying some popularity, reportedly being installed on 1% of all domains by 1998. At this point, the language looked nothing like we know today. It was entirely written within <!-- html comments -->, with syntax noticeably different to modern versions.

Enter Zeev Suraski and Andi Gutmans, who were using PHP to try to build a business but found it lacking in features. Collaborating with Rasmus, PHP was once again re-written and released as PHP 3.0. Now we’re getting somewhere, with PHP 3 installed on an estimated 10% of domains at the time. This is also the point where the meaning of PHP changed from Personal Home Page to everyone’s favorite recursive acronym, “PHP: Hypertext Preprocessor”. This version and period is generally seen as the time in which PHP cemented its future status. Between PHP 3 and 4, phpMyAdmin was created, Zeev and Andi mashed their names together and founded the PHP services company Zend, and the venerable elephant logo appeared.

The rest is history: shortly after PHP 4 came Drupal; in 2003 we got WordPress; then in 2004 along came a student at Harvard named Mark.

Facebook and PHP

Facebook famously started as a PHP site. But when thousands of users became millions, and millions were beginning to look like billions, there were growing pains.

In particular, PHP was (and still is) a scripting language. Great for developer productivity, not so great for resource efficiency. So in 2008, Facebook began work on HipHop for PHP, a transpiler. Very simply, it parsed PHP, transpiled it to C++, then compiled the resulting C++ into x64. This was no mean feat given that PHP is weakly-typed and dynamic. But the results speak for themselves: a 50% reduction in CPU load.

I’m sure you’re imagining the horror of working as a developer at Facebook using this process. Making a change to the PHP code, running the transpiler, then compiler, drumming your fingers, running the executable and finding the problem you need to go back and fix. That’s a pretty long iteration cycle, which is why Facebook also developed HPHPi, an interpreter that does the same job as the transpiler/compiler (HPHPc), but just to be used for development. As you can imagine, keeping the two projects in sync was an almighty headache, so in 2011 they developed HHVM, the HipHop Virtual Machine.

HHVM is a PHP runtime. It uses JIT (just-in-time) compilation to provide the best of both worlds. It’s pretty cool, and you can read more in Facebook’s own blog post if you’re interested. The next big step came in 2014, with the invention of Hack, a language specifically built for HHVM. It’s both a superset and subset of PHP, adding optional type annotations and extra features such as asynchronous architecture. It also helps make HHVM’s JIT more efficient by enabling it to optimise with confidence using the specified type hints. Soon, new code at Facebook was written in Hack, with existing code being converted over time. Both Hack and HHVM are open source, and actively maintained today.

Does the fact that Facebook found PHP in its native form unusable at scale mean that it’s a badly engineered language? No, I don’t think so. I don’t believe any of the options which were around at the time had been created for the scale or specifics which Facebook required. However, that doesn’t stop people using it against PHP.

The Hate

Within the wider software community, as PHP became larger it inevitably drew fire from a growing group of cynics. Except, PHP objectively speaking gets more hate than most other languages. According to the recent 2020 Stack Overflow Developer Survey, PHP is the sixth most dreaded language. Why?

I don’t want to get into technical minutiae here, but if you do, PHP: a fractal of bad design, is the bible blog post for PHP haters. Written in 2012, some problems it mentions have since been fixed but many haven’t. (eg: why is there no native async support in 2020?)

Stack Overflow 2020 survey of most dreaded languages

I think more general problems lie in the philosophy of the language. It’s a tool for a fairly narrow domain, implemented in a complex way. In an ideal world, if an application must be complex, the complexity should be visible to the developer in user code, not the language itself. You don’t need a complex tool to create complex projects. When I say PHP is complex, I’m not saying it’s hard for beginners to use (quite the opposite in fact), I’m saying it has inconsistent naming conventions and a lot of very specific functions, both make it easy to create errors which aren’t caught until runtime. But are these simply properties of PHP’s age, to be expected? Whilst perhaps a factor, it’s certainly isn’t the reason for the hate. After all, Python was created in 1989, six years before PHP, and comes in as the 3rd most loved language in the Stack Overflow survey, as well as being one of the fastest-growing languages today.

When it comes to security, there’s some debate as to whether the above-average number of vulnerabilities on PHP sites are the fault of the language or the site developers. On the one hand, a coding language designed to appeal to a broad range of people including non-programmers, who produce sites with code hacked together from decades-old tutorials will always have issues, no matter the merit of the language itself. On the other hand, PHP has attempted to fix basic security issues in questionably convoluted ways, for example fixing SQL injection first with escape_string(), then fixing vulnerabilities with that by adding real_escape_string(), then adding addslashes(), mysql_escape_string(), pg_escape_string() and so on. Add this to its labyrinthine error/exception handling (yes, errors and exceptions are different), and it’s easy to make mistakes if you’re not well versed in the nuances of the language. The amount of sites running old, unsupported versions of PHP past their End Of Life continues to be staggeringly large, so PHP sites will continue to be low-hanging fruits for hackers for years to come.

Be this as it may, I’m not convinced that the problems the language has are as large as many would make out. Despite there being reasonable grounds for complaint about PHP, it seems to me that much of the stigma is absorbed because it’s fashionable, rather than reasoned by individuals.

The Future

This author is well aware of the irony of typing critiques of the language into a page with post.php in the address bar. But this isn’t about existing sites. I don’t think even the most ardent pitchfork mobs would suggest that we re-write all existing sites made with PHP. The question is, in June 2020, if I want to create a new website, should PHP be an option I consider?

There is no doubt that the current web development trends are setting a course for Single Page Applications – where your browser never reloads, but navigations occur from Javascript re-rendering the page using data from lightning-fast API calls (eg: browsing GitHub or Google Drive). There is an ever-growing ecosystem of Javascript libraries, frameworks, and tools for building reactive and performant applications in the browser — React and Vue being the most popular.

Ultimately, PHP is for server-side rendering. That’s fine for most sites and the best option for many. But if you’re building something new in 2020, you have to accept that this brings limitations. And whilst PHP-style server-side rendering isn’t dead (did everyone forget about SEO?), modern sites are likely to be Isomorphic, that is, able to render the same Javascript on server and client, using frameworks such as Next.js (for React) or Nuxt.js (for Vue), putting PHP out of business on the server.

But we can’t ignore the fact that PHP is evolving too. Laravel, self-publicised as “The PHP Framework for web artisans”, provides an MVC architecture for creating PHP applications safely and quickly. It’s held in high esteem by the community, and enjoys active and rapid development. Additionally, PHP 8 is coming out later this year, with a bunch of new features (many of which will look familiar from the Facebook section), such as a JIT, Union types, and improved errors.

So, happy twenty-fifth birthday PHP, you are endlessly quirky and will undoubtedly endure for many more years. You’ve empowered many people and played a key role in the rise of the web. But don’t be too upset if people are looking elsewhere for the future, it’s 2020 after all.

51 thoughts on “Does PHP Have A Future, Or Are Twenty Five Years Enough?

  1. I love the self-contained nature of PHP processes. I love not having to deal with Async/await/promises or whatever they invent next to handle multithreading in Javascript. I love the flexibility of the language, although this comes with a completely PITA way of debugging. People go nuts with strong-type, leave me with my on-the-fly string-to-int-to-bool conversions just because ;-)

    Let the hate flow. PHP can withstand it because it just works. And that’s enough for me.

    1. ^^^ Oh god, THIS.

      async/await/promises , something().then(somethingElse())… just to write some multi-step process. That madness was the beginning of the end for me. Javascript on the server? It’s bad enough in the browser. No thanks.

      PHP made me some serious money, so I’m pretty grateful for it. I’m currently getting better in Python, but same as learning German when you’re in your 50s, I will always have a Web 2.0 accent to my code.

      1. “async/await/promises , something().then(somethingElse())… just to write some multi-step process.”
        I also hate javascript because it is too taxing in terms of developer experience. But I disagree that the declarative nature of async/await/promises that you mentioned, especially the functional nature of .then() is one of the bad parts of javascript.

    2. “People go nuts with strong-type, leave me with my on-the-fly string-to-int-to-bool conversions just because ;-)”. I can imagine the mental load you put to other people reading your code. You will make them bald fast. I hope you are not getting burnt out also.

    1. I used to use MediaWiki as a defense of PHP until here I am 15 years later and it’s still the only well written PHP I’ve come across. PHP is great for its original purpose, Php Hypertext Processing hence the name and little else, and as more and more third party libraries got bolted onto it two or three times each it got further and further away from that purpose and closer to Perl 6

  2. The only possible future of PHP was to defeat ASP + ActiveX controls, which is now acted.
    Personally I suffered enough debugging, troubleshooting, caching and scaling it, I would prefer to let it die silently.

    1. Nah. ASP.NET is having a moment right now. It’s fast, easier to work with than PHP, and it’s C# which, IMO, is a lot better than PHP in terms of syntax.

      ASP died out because it couldn’t run on Linux. Now it can, and PHP’s list of benefits is really, really small.

    2. Like most languages, PHP was written because other languages were found wanting.
      Like most languages, PHP is also found wanting.
      Like we have done in the past, we will no doubt abandon this toy and go an play with the next, and thus it will add to the great garbage patch of poorly understood, poorly commented, completely unsupported code that pollutes the coding universe.
      Rather than write it off, or let it die, perhaps we should instead embrace its positives, and fix its negatives.
      Continuing with that lovey dovey, warm all embracing, cosy, cotton candy theme, VBA of course should be taken round the back of the toilet block and shot. ;¬)

      1. This is what I’m talking about. It’s as if people aren’t aware that they are being needlessly negative, in a way that is not remotely equivalent to logical consequence, as implied. A lot of very good design in PHP these days. Life is a mirror. You will find what you are looking for. YOU are looking for a cloud to go with any silver linings, and most people don’t seem to realize that we lead with emotional disposition, then back-fill the mind with rationalizations and justifications. Bullshit.

  3. I used to think PHP was marvellous but not any more, I have moved to Go. PHP will be around for a long time yet but I just think things have moved on and it will gradually decline in popularity. I’m sure that plenty of hobbyist programmers will continue to use it, but larger scale projects will not be using PHP for new developments.

    Inevitably there will be people that are fans of PHP and are so invested in it that they will defend it to the very end, that is the case with any technology that is being displaced. At the end of the day people will use whatever works for them, but I wouldn’t be starting a new project in PHP.

    1. “I’m sure that plenty of hobbyist programmers will continue to use it”

      The same way tons of school still hang on VBA and Microsoft Access, many will not upgrade their teaching material and teachers for a while!

      You can be assured plenty of PHP-raised web developers will still hatch in the future, just to find their job perspectives increasingly shrinking.

  4. It is not what it used to be.

    PHP has grown up. Today we develop reliable, well tested, fast enterprise applications with it, all using mature object-oriented patterns. Long behind are the days of the PHP transactional script. Composer (PHP dependency manager) is definitely up to par with other platforms’ counterparts (or better).

    PHP hate might have remained a thing in some communities and yes: built in function naming sucks, yes: the underlying legacy error handling is a mess… But PHP is not going anywhere, it has stayed a top 10 language for decades for very good reasons.

    1. PHP is ok but it’ll be phased out eventually. The new paradigm of async API calls means that the backend is more easily and incrementally replaceable. Mixing frontend and backend code is gross anyway

    1. Java? Seriously? It’s one of the most well developed languages of today and it’s fast and portable. There is a Java NIO based server out there that is faster than some C++ servers. I moved to Java from PHP and I’m never going back.

  5. I haven’t had the time to read the article yet, so I’m just responding to the title. PHP is not going anywhere. Like M$ it has too much “momentum”. Stats I read last week show it as the super-majority for dynamic sites, with NO near competitor. Personally I’d rather develop a website in other languages. But PHP does NOT have a spot on my “language hate list”, meaning I consider it usable. For large volume sites I prefer a real native-code compiled language. Argue as you might “law-4” ALWAYS bites ( My other issue with the language was that it appears to be trying to figure out what sort of language it ought to be. But after many years I think it may be finding itself.

  6. I think single page design sucks. Sorry, not sorry.

    I don’t use bookmarks like I did in 1995 but I do still want to bookmark something occasionally. Or, more frequently I might want to email a link. I hate that for so many sites these days if you want to share a link you have to enter the recipient’s email address and let the site send it to them for you, all the while trusting without reason that you didn’t just sign your friend up for a ton of spam.

    With very few exceptions I want the exact URL in the address bar to function later to either take me back to exactly what I am looking at now or to a login page where after logging in I will be automatically redirected there.

    And the back button! If I press it and end up somewhere other than the last thing I looked at then I am finished with your site!

    As for moving away from PHP. I don’t know. I would hate to have to develop a site without $_SESSION. What language has a similar concept? I guess I could roll it myself with cookies and database code but that seems a bit ridiculous when PHP already exists. I’m sure popular frameworks bake that in but I don’t want to use someone else’s framework. I prefer to develop my own in PHP. Whenever I have tried to use someone else’s framework it has been too limiting. Either it’s only good for a cookie cutter site with no original features or you have to learn to develop a plugin and you have to learn how to think just like the person who wrote the framework. It’s easier to go from sratch.

    As for all the hate for PHP… Yah. There is some really shit code out there. PHP graduated from being just a collection of toy perl scripts to a “real” but not very well designed language at just the perfect time. Everyone suddenly wanted to develop something for the net and they wanted to do it yesterday, even though they had no programming experience. So they would go buy a book, skim less than half of it and start clacking out crap.

    Years later the rest of us are still being asked to maintain their crap. Meanwhile PHP has evolved into a quite decent object oriented language. One can write very clean code in PHP IF one makes the effort to do so. It doesn’t try to enforce much on the user. That’s not a bad thing, if you chose to code like you care what happens when you have to maintain what you write in the future. It’s a choice.

    1. Same sentiment with SPA, they suck, and they broke the beautiful model behind the URL concept (almost nobody understand it).

      But the most strange to me is that nobody mentions the unique ‘request’ -> ‘process’ -> ‘OS cleanup’ that PHP has.

      There is no other language like that. And to me, is the main advantage of the language (if you are not FB or Google, of course, but you do not).

      Someone said that the most difficult thing is CS is to maintain state, and is so hard, that sometimes you just have to reboot the machine, so all the state is resetted.

      And php does something like that, once the request has been processed and dispatched.
      I prefer that stability over speed, always.

    2. Just don´t build SPA apps without a router. Vue, React, Angular (…) all got one. It makes URLs readable and easy to bookmark and SEO-ready, and makes URL structure changes a breeze.

  7. A lot of the reasons the article gives are kind of irrelevant in modern PHP development. PHP 7 performance is an order of magnitude better, rendering things like HHVM obsolete. And it keeps getting better, with things like stronger typing in 7.4 and JIT in PHP 8.

    The bottom line and best reason though – is developer productivity. After working with everything, Python, Ruby, Node, React, Vue, in my experiences can easily say this: A smaller team will create applications faster, spending more of the team’s time building the actual domain logic and business needs using Laravel/Vue than with Node/Express/CreateReactApp. The entire Laravel ecosystem provides a super solid foundation for almost all the problems I need to solve as a modern engineer.

  8. “(did everyone forget about SEO?)”

    Google has been doing a bang up job of crawling and indexing a huge content filled site I am running in React with a simple json api backend. I am not sure about the other search engines, but I am sure they are going to play some catch up and do the same thing.

    I also run a huge content filled site in PHP, and google crawling is the most painful thing about keeping it optimized. When you make the only thing that needs to be fetched is a slim api call, the impact of crawling becomes minimal. All the javascript is just held in the crawler cache.

  9. Self-taught PHP programmer who did all of the things that gave PHP a bad name. Learned C, C++, Python, etc, and principles of OOP and organized code, and still love PHP. It’s not going anywhere. It is under-reported PRECISELY because it still holds such dominance. Industry folk like to agitate the ecosystem and promote what ever isn’t already on top.

    The thing I don’t like is CS school grads shitting on PHP for reasons that are all abstract and concern only a CS student. To all of the people who use PHP apps to get stuff done – you just aren’t smart enough to know what a loser you are /sarcasm. Seriously, though, this is a psychological thing and an identity thing for the haters. You went to school and learned discrete mathematics and algorithms and the housepainter next door is able to call himself a “programmer”. I think that’s what hurts the most.

    1. PHP is absolutely capable of doing computer science. It is Turing complete. Sorts, graphs, tree’s, recursion, and space time analysis can be done using PHP. I’m guessing these algorithms in PHP are faster than in Java or Python.

  10. It’s already dead to me; along with SQL. My website got so many hack attempts and spammy posts to comment threads that I threw out the whole WYSIWYG system and went back to all hand typed text and html 1.0. I’m much happier and don’t get a ton of email notifications of blocked IPs from Russia, China, etc. I don’t have to go hacking pages to get simple functionality that I want and then have to rehack when updates get pushed out.

    My site runs faster, I actually post to it more now that it doesn’t take 10 minutes of waiting for php pages to load from login to logout, and there’s less headache all around. My site is basically just for me, so I don’t care if no one likes it.

    This isn’t really hate on the language itself as it is on the unneeded complexity it bestows on the web. As a language, meh, it’s ok. Somewhat C/Python like. Enough so that I never needed to “learn” it to hack around a bit.

    1. It seems you are talking about WordPress. You can use PHP to generate static websites. I’m with you on that one; you don’t need a full fledged RDBMS and programming language to run a simple website.

      1. Doesn’t sound like any WP site I’ve worked on, but it may be one bloated with unnecessary plugins. Sounds like a very poor hosting environment.

        Why are you receiving notifications about blocked Russian IP? Who cares? Why are you even IP blocking? It’s a waste of time since botnets were invented!

    1. Yes!! Thanks for sharing that. “PHP: The Right Way” is a great reference indeed!
      It is written and maintained by the same author of the Slim Framework (
      I develop Single Page Applications using modern Javascript on the frontend (I love reactive user interfaces) but the backend APIs are entirely implemented in PHP using the great Slim Framework, plus all the PHP packages that I need available in Packagist and installable with Composer.
      Some of my web applications are somewhat complex. Everything works well and as expected, everything is stable.
      Code cleanliness and security are assured.
      Full-stack javascript advocates advise that using different languages for the frontend and backend leads to code repetition, but I can perfectly live with having a backend layer, a frontend layer, and a shared layer if needed (for example, some JSON objects describing common structures) even if someone tells me that this way the frontend and backend will get tightly coupled.
      Separation of concerns must exist and should be the principle.
      For me PHP is the past, the present and the future!

  11. Few years back I built a robot that used php. It was before html5 took off and all I knew at the time was php, html, and tiny bit of JS. Had a crap Windows x86 tablet I hot glued some continuous servos to the bottom with a USB to Serial servo controller and 4AA pack. Php can fwrite to com ports directly. A webpage with 9 buttons (8 directions and stop) would fire off ajax requests to the php script which would fwrite the control bytes for the selected direction. I glued a tiny chunk of mirror to redirect the table’s camera “forward”. Skype called the table for video/audio and used the webpage to drive. Let friends online chase my cats around remotely.

  12. PHP must be considered as it is, an extension to Javascript for persistency, email automation, database query. Ajax techniques are the best example. It lack of consistency when processing strings, test, etc… So even in one page applications, write most of the code prior in Javascript, and just few functions in PHP.

  13. ” I’d be willing to bet that for the majority of readers of this article, their first forays into web programming involved PHP.” Actually I started in the early 90s – so it was Perl for me. Then Javascript.

  14. I don’t know if most people don’t know or forget, but PHP’s source code has more C than any other popular language e.g. (PHP = 64% C, Python = 29% C, Ruby = 28% C, etc.) … C has the best combination of space & time & energy complexity the human species can offer. Other than C itself, PHP might be the most powerful popular language out there.

  15. Haters on PHP are like haters on a pen. One or the other pen doesn’t make you a good fantasy book author. If you don’t know how to write clean good code, every language sucks. The real problem we have is Javascript in the backend. If you want to discuss on a bad designed and way too loose language the let’s talk about JS. PHP will stay a long long time.

  16. The next big step came in 2014, with the invention of Hack, a language specifically built for HHVM. It’s both a superset and subset of PHP

    Hack contains all of PHP. PHP contains all of Hack. Doesn’t this mean that Hack == PHP?

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.