N
N
Nikola_y2014-11-07 06:16:35
PHP
Nikola_y, 2014-11-07 06:16:35

Can php be replaced with node.js?

Is it possible to use node.js on the server side for the site?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Alexander, 2014-11-07
Madzhugin @Suntechnic

Can. At least for now. And there it is not known what else will come into our deputies' heads ...

K
Konstantin Kitmanov, 2014-11-07
@k12th

Yes. There are only two problems: standard shared hosting does not yet offer support for anything other than PHP, but at today's VPS prices, this is not such a problem. And it is more difficult to find at least a sane JSer than a qualified PHP specialist.

M
Mikhail Bazhenov, 2014-11-07
@benign

Need!
I myself write in PHP and node.js
If you need to do it quickly and on a budget, then PHP
If you need to do it complicated and tricky, then node.js
This is such a choice for me personally
But in PHP you can write everything the same as in node.js, only application performance and results goals will be different

S
Sergey, 2014-11-07
Protko @Fesor

It is possible, the only question is why do you need it and what will it give you.
And yes, do not forget that when deploying a node.js application, you will have to take care that it does not fall. Ideally, all this is handled by some express.js - that is, without frameworks in node.js, flattery is not worth it at all if you have little experience.
Also, if the server you are deploying to has more than one core, then you should run one application instance per core and proxy requests to them through nginx. node.js is synchronous by default. That is, all that vaunted asynchrony appears only when it comes to I / O. JS code is executed in one thread, two lines of code cannot be executed simultaneously. Therefore, you will have to wedge in some process managers, etc.

A
Alexey Yaroshevich, 2014-11-13
@qfox

The architecture of PHP and Node.JS is different, so in general, no.
But in special cases, for example, on home pages or some kind of service handles, it works with a bang.
Unfortunately, no one has yet written an analogue of the apache + mod_php bundle for node.js, so that you can simply change the files and immediately see the result in the browser, but this is a matter of time ;-)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question