View Single Post
Old June 3rd 21, 10:48 AM
henrycooper henrycooper is offline
Junior Member
First recorded activity by WordBanter: Jun 2021
Posts: 1
Default When to use PHP or Node.js

Both are back-end languages, but Node.js can give you an edge if you're looking for a system that uses JavaScript in both front-end and back-end. If you're trying to choose between back-end technologies, it's probably a good idea to go into a little more detail.

When to use PHP?

Centralized server: In case we don't plan to scale our application to multiple servers, we can use LAMP (Linux, Apache, MySQL and PHP). This may vary depending on project requirements.

Portability: PHP is a flexible language. The low cost of web hosting and the availability of servers for PHP is beyond the table. PHP can run on almost any platform that has Apache, IIS installed and has a supported database system, which makes PHP applications flexible and easy to deploy. smash karts

When to use Node.js

Sharing a language: Node.js would be the correct choice to use if your project involves things like MongoDB, ExpressJs, AngularJs, BackBoneJs, ReactJs, SPA (single page applications),.. this makes it easy to have a system entirely using JavaScript.

Realtime: Node.js is very good for applications that require realtime, but I would be concerned about using Node.js for applications related to finance and money, because Javascript itself is not reliable when talking about numbers since everything is either integer or float and there's no real clear separation between the two, "floating point number" is a prime example when it comes to JavaScript calculations. A more secure language is recommended when working on financial applications that require a lot of computation, or need to install a sufficiently reliable library.

Speed: Node.js is much faster than PHP when it comes to execution speed, if speed is all you need for your application, such as a single-browser multiplayer game or app For chat applications, Node.js is a better choice than PHP.