Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How efficient NodeJS compared to PHP?

user-image
Question ajoutée par edbert sherlo , Software Engineer , Webcrafters
Date de publication: 2017/09/16

  • PHP is a programming language for writing code and it is also at the same time an interpreter of PHP code to the operating system (like Linux or Windows) installed on the server. Node.js is not a programming language; it is rather an interpreter of Javascript code (due to the Google Chrome V8 engine) to the operating system installed on the server. Node.js is not just an interpreter because it is extended with the libuv library that focuses on asynchronous I/O.
  • To execute PHP code on the server, one needs to install PHP package or Facebook HHVM package. To execute JavaScript code on the server, one needs a Node.js installer.
  • As a part of the real-world web applications, PHP code should work in conjunction with a web server. PHP has a built-in web server but it is not recommended for use on a production hardware server. As a rule, developers use Apache web server, Nginx web server or any other servers that support FastCGI or CGI protocols. As for Node.js, it has built-in tools for creating servers, hence it can work without the help of external servers. However, as a rule, Nginx server is used as a reverse proxy before Node.js server on a production hardware server.
  • Node.js provides a purely evented, non-blocking infrastructure to script highly concurrent programs.
  • Javascript is designed specifically to be used with an event loop: anonymous functions, closures; only one callback at a time; I/O through DOM event callbacks. The culture of JavaScript is already geared towards evented programming

In terms of RAM usage Node.js is better then PHP. 

 

I would prefer Node.JS for Chat, multiplayer game using web socket .

And Its the Frameworks, not the language which typically introduces the security enhancements .

 

Finally its the requirement which can take the decision upon the framework.

 

Konduru Venkatesh
par Konduru Venkatesh , Software Developer , UnoCareer Pvt Ltd

The main thing is Node is Non-Blocking. You can find the more info on below link.

 

http://www.hostingadvice.com/blog/comparing-node-js-vs-php-performance/

More Questions Like This