PHP is a server-side scripting language, mainly used for dynamic web development, and is currently one of the most popular development languages. Node is a JavaScript toolkit for writing high-performance web servers. The author Jani Hartikainen published a blog post comparing the two and listing five reasons why PHP is better than Node.js. Let’s take a look.
1. Easy hosting
Most web hosting Server providers can provide hosting for PHP, but for Node, you need to find a more professional hosting provider. Typically, shell access is required to set up the application, and most hosting providers don't include this, and even if they do, other packages are relatively cheap.
2. PHP is more convenient and simple to install on the server
PHP can easily install WAMP, LAMP or MAMP, and deploy the code to a Web virtual host, just Just drag and drop the files and you're done.
Although Node itself is not difficult to install, it still requires more expertise to set it up. In order to install it on the server, you usually need to know some knowledge about Linux system administrators. This will ensure that node can run well when the system crashes during the installation process.
3. If the PHP code is damaged, it will not bring down the entire server
The PHP code only runs in its own process scope. When a request shows an error, It only affects specific requests. In the Node environment, all requests are in a single process server. When a request causes an unknown error, the entire server will be affected.
4. PHP process is short-lived
In PHP, each process lasts a very short time for requests, which means you don’t have to worry about resource configuration and memory. . Node needs to run for a long time during the process, so you need to be careful and properly manage the memory. For example, if you forget to delete an entry from global data, this can easily cause you to leak memory.
5. Larger standard library
PHP’s standard library is much larger than Node’s standard library.
Conclusion:
Of course, this does not mean that PHP is better than Node in all aspects. In some things, Node is still very good (for example, real-time information Processing wise), Node is an interesting product with an elegant architecture. Although Node.js is not a silver bullet, it is still a bullet.
Developers always have different preferences for programming languages. Each language has its own value. The author believes that choosing the most suitable one is the most important thing. In addition to the above, in what ways is PHP better than Node? You are welcome to list it in the comments.