PHP was created in 1994. In order to be used, it usually has an interpreter installed as a unit within Apache or Ngix. PHP code can be merged with HTML.
Node.js was created in 2009. It is relatively young, but it’s constantly winning its share on the market.
For a starting point, PHP wins, being conceptually simpler. It has more software dependencies, but its concepts are easier to understand.
For help and support, PHP is better because it has more than 20 years of documentation. So whatever your problem is, somebody had it before and you can easily find the solution. The younger Node.js has a good documentation, too.
When it comes to language syntax, Node.js wins, because once you understand it, the other languages will seem cumbersome. PHP syntax can change between versions and this has led to a problem: PHP language is a little messy.
Development tools: both PHP and Node.js own a good range of debuggers, editors, validators and other tools. But Node.js has a tool that makes it better – npm or Node Package Manager. PHP has a tool inspired from nmp, Composer project. However, it has a smaller impact on its users, as it is not provided with PHP by default.
Talking about environments, PHP is a technology based on servers. It is really efficient for tht kind of tasks, but it rarely goes beyond it. Of course, there are ways to use it on desktop, too, but it is not created to be operated like this. JavaScript, instead, can be used everywhere (from the servers, to desktop, in the browser and even embedded systems. Node.js has made JavaScript omnipresent.
Being older, PHP is strong in the integration area. It has extensions which authorize direct communication with APIs. Node.js is reaching the point where integration is easily done, but having less years of experience as PHP makes it harder to find integration ways for older technologies.
PHP wins at hosting and deploying a new app to a live server. For Node.js, you’ll need a cloud, real or virtual or a specialist server environment, ideally with root SSH access.
The younger runs faster. Node.js performance is generally better. But PHP is not bad either. It has projects and options to make it faster.
Even though it is a little bit subjective, Node.js wins when we talk about the programmer’s passion. PHP is old and it lost its user’s interest, but you can see that when we talk about Node.js, there are two clear teams: those who love it and those who don’t appreciate it.
So what will happen next? Even though PHP is older, it will survive for at least twenty more years. Node.js grows rapidly and it offers modern development solutions. Even though it will gain some of PHP’s market share, they will both survive, having a strong future.