TL;DR: PHP is not going to disappear immediately, but its positions are undermined even further by the nascent Node.js.
When the Internet exploded in the 2000s, PHP was a thing all the cool kids did. It was extremely revolutionary, because:
- It was an interpreted language unlike C++ or Java which require the source code compilation
- It had the ability to be used directly with HTML by mixing within its template files with a
<%php ... %>
markup tags - It had cheap shared hosting providers on Apache servers with a Linux, Apache, MySQL and PHP (LAMP) stack
- It had a functional nature which is easier to learn than the object-oriented programming
Over the years, PHP and its apps became a monstrous technology vulnerable to security threats (e.g., SQL injections), lack of a centralized packaging registry (was Composer inspired by Node Package Manager?), inconsistent API and subpar performance. There are many better alternatives to PHP, e.g., Ruby on Rails and Django, however nothing is as approachable as Node.js.
For those of you who aren’t familiar with Node.js, or who have heard of it but can’t quite grasp the concept, here is my analogy:
Node.js is functionally similar to the PHP + Apache or ASP + IIS stacks.
Nowadays, Node.js is gaining momentum. The platform uses JavaScript. It’s functional, and its non-blocking I/O mechanism allows for a better performance. Node.js comes with a robust Node Package Manager solution and the specification, i.e., ECMAScript.
Because Node.js is a lower-level technology, it is not comparable to complex frameworks like Struts, Rails or Django directly.
Therefore, many people, whether software engineers or entrepreneurs, are often faced with the decision of “What tech stack to use” In this article PHP vs. Node.js, we’ll compare apples-to-apples approaching the question from different angles, such as:
- Syntax
- Context switch
- Modules
- Ecosystem
- Frameworks
- Real-time apps
- Database apps
- Third-party services apps
- Web servers
- Hosting
- Performance