Skip to content
Liquid Labs
All articles
Technology

Why PHP refuses to die, and where you should use it

As you might have guessed from how much of the world's websites were affected by the recent PHP2Shell vulnerability (nearly 70%), PHP is still alive and well.

[Author][Date]3 minute read

In 2015, I unwisely predicted the death of PHP. I had just spent the first ten years of my career working with C++, and then two more years working with JavaScript, particularly the then up-and-coming Node.js, which was literally 3-4 times faster than PHP at the time. An untyped, interpreted, synchronous language that spawned one thread per request and had no memory persistence across requests felt like a poor choice for any application other than a personal home page (incidentally, that was what the acronym PHP originally stood for: Personal Home Page).

However, as you might have already guessed from how much of the world's websites were affected by the recent PHP2Shell vulnerability (nearly 70% by some estimates), PHP is still alive and well. In fact, when faced with the choice of tech stack for a new product venture recently, I chose PHP/Laravel over Node.js, Java and .NET Core. Despite the recent vulnerabilities, I still think that was the right decision. I also work with at least one client with a business critical B2B product that runs very well on the same stack (by the way, as of this writing, there's an open engineering position for this client. Please check the Liquid Labs careers page if you're interested).

The reasons that PHP refuses to die despite all its warts, in my opinion, are as follows:

Firstly, it had a head start: it started out in 1994 as a set of cgi-bin tools and was later adopted by many early content management systems, frameworks, and e-commerce apps (e.g. Wordpress, Drupal) which are in widespread use to this day.

Secondly, many supposedly better alternatives (J2EE/JSP/Servlets, ASP) had steeper learning curves, complicated setup, tooling and deployment requirements. The PHP stack, on the other hand, had four default open source dependencies: Linux, Apache web server, MySQL and the PHP runtime (i.e. the LAMP stack). This has largely remained unchanged for a quarter century, while competing stacks have undergone a bewildering series of upgrades (minor exception: Nginx is becoming a better alternative to Apache).

Thirdly, PHP's simplicity means that developers spend more time thinking about business logic and data, and less time grappling with language syntax, configurations, dependencies and tooling -- a disadvantage the React.js/Node.js ecosystem has unfortunately become known for. PHP is a "dumb" language in which it is exceedingly easy to do CRUD operations, which is 80% of what most business applications are. Granted, it may not be the best stack if you want to scratch an itch for building things with new and shiny technologies. But we're now entering an era where software engineers increasingly (and perhaps unfortunately) do not have that luxury and must prioritize delivering business value over technical innovation.

Finally, PHP has evolved so gradually and without much fanfare over the past decade that many people are unaware that its past reputation as a slow, hacky and insecure language is out of date (the most recent CVE notwithstanding).

In summary, if you're a resource constrained team that needs to iterate fast in a domain that consists mostly of CRUD operations on non-time-critical records (e.g. no aviation, no trading systems, no medical systems directly in the treatment loop) PHP is still a wise choice and may continue to be so for some years to come. In fact, with LLMs significantly bringing down the cost of porting code bases from one language to another, it may be viable to go to market with a quick and simple PHP implementation and port it to the target language later.

Note: some of the arguments I make here also apply to Python and Ruby. Python, I may cover in a separate article. Unfortunately my exposure to Ruby is simply not enough for me to authoritatively comment on it.

More articles

Talk to the founders.

Tell us about your product and the team you need. Gehan or Hasitha will reply.

Talk to the founders