Web development is constantly changing. In order to stay relevant, programmers must analyze trends and learn the next "big" technology stack. The debate between PHP and Node.js is fairly old news. That being said, let's review some of the pros and cons of using either language from a developer standpoint.
Node.js is rapidly growing and was quickly adopted by Netflix and Walmart. By contrast, PHP is slowly declining. However, the language is still being widely used due to the popularity of PHP content manager systems like Drupal and Wordpress. Surveys suggest that nearly 80% of today's websites were created with PHP, whereas a mere 4% were created with Node.js.
No, PHP is not a dinosaur that went extinct (although that was a good guess). PHP is a scripting language well suited for web development because you can embed server-side code directly into HTML. PHP features a loose typing system and object-oriented features (classes). Here's what "Hello World" looks like in PHP.
<?php echo "Hello World", ?>
require("http").createServer((req, res) => res.end("Hello World")).listen(8080);
Neither PHP nor Node.js is difficult to set up on a local environment. Both can be integrated with VS Code or another editor. With XAMPP, setting up PHP servers are relatively painless. Just click a few buttons to enable Apache and MySQL and you have a fully featured server running on localhost. Building servers from scratch in Node.js takes far more effort, but half of the language's power comes from frameworks like Express anyways.
With many different server and platform options to chose from, PHP can literally run on any configuration or operating system necessary for hosting a website.
PHP has been around for a while and is still actively being developed. Programmers are continuously updating and improving the stability and security of PHP. This is not to say Node.js doesn't have its own community of developers - just that PHP has been around much longer.
Developers without much technical background in PHP could probably make an entire blog or e-commerce websites because of the built-in functions and integration with MySQL. Node.js can make MySQL connections, but production apps often abstract queries behind an API layer (which can take longer to set up).
PHP's age is as much as a bonus as it is a disadvantage. Traditional techniques of HTML rendering and creating database connections are slow and rigid. Node.js is pioneering new rendering models, such as the JAM stack with serverless functions.
There is no set programming style that should be used when developing Node.js applications. In addition, the large range of available modules shipped with NPM makes developing applications easier to implement.
The V8 engine and asynchronous nature of JS allows Node.js to handle far more requests than PHP can in a shorter amount of time.
Node.js is single threaded, making it less than ideal when handling graphics, audio, or video.
Node.js hasn't been exposed to the market for that long in comparison to PHP. In addition, many NPM modules are untested or unstable, creating security loopholes that are difficult to eliminate when developing a production application.
It is difficult to say whether PHP or Node.js is better than the other. In fact, it really depends on the type of application you are trying to build. For example, it would be much easier to build a Single Page Application (SPA) with Node.js because frameworks exist to simplify the process. However, you may find that it is easier to deploy PHP applications simply because it is supported on nearly every server.