@Mark It's not really apples and oranges in this case. More so than other languages used for building applications, PHP can't really be separated from all the built-in stuff that comes with it. It becomes more of a platform, like node. There are a lot of significant differences, but those differences are worth discussing I think. The question does need to be framed better though.
@Sean You should give a little context for us. If you're choosing a technology to tackle a certain problem, there's all kinds of things you might consider. Here's a few. Keep in mind these are node-biased because I'm a node guy, but I've done a lot of PHP too. I'm also assuming you're building a semi-standard web application. But you can build lots of other stuff with node. - Almost all i/o in node is non-blocking. This means everyone on the team will have to get comfortable with asynchronous programming. Callbacks, promises, whatever you like, but it's a major shift in thinking for most people. - PHP typically uses one process/thread of execution per request. Node isn't built this way. Instead, multiple connections come into the same process. There is one thread of execution managed by an event loop. This has lots of implications. If you're not sure what those implications are, you should strive to understand this first IMO. - Node has built-in servers. You have to run PHP through a web server application like Apache or Nginx. They manage spinning up multiple php processes and loading all of your code into each one. With a typical node web app, you load your code up front (or on demand) and start your web server to start receiving requests. Node modules are cached and reused. Essentially you're maintaining application state in the VM. Again, lots of implications. - Node has excellent support for streaming data. In fact it's integral to keeping node applications fast and efficient. I'm not that familiar with the support in PHP. - Node has excellent support for high numbers of tcp connections. If you dig into the way the non-blocking stuff works, it also feeds into why a node server can handle 1000s or 10s of thousands of concurrent connections with way less overhead. Most request per process/thread systems break down here. - The node community has used several of these features to build excellent support for real-time data and distributed messaging. If you've got any real-time requirements, that's a big point for node IMO. - Node doesn't have the level of framework support that you get in PHP. You have to make a lot of decisions about you want to do things, compared to say using Zend or CakePHP. This is progressing though. See expressjs, geddyjs, etc. - The node module system and npm ecosystem are top notch. When I compare these to my experience with managing dependencies in PHP, there's no contest. - That said, node has a relatively small "core". You'll have to dig into the userland module landscape to find anything but the basic stuff. We think this is a good thing. Some find it frustrating. - PHP has way more information available to learn from. Node is still building on it's ecosystem of information. It's sometimes to hard to get the answers you want. There's a lot of do-it-yourself exploration. - Node is way more fun than PHP If you ask more targeted questions, maybe people can expand on these. Good luck. :Marco On Wednesday, November 28, 2012 4:40:10 PM UTC-8, Mark Hahn wrote: > > It would be like comparing apples and oranges. Node.js is not a language > or template. You need to compare javascript to the php language. > > You should be aware that nodejs is lower-level. You end up writing more, > and the async code requires a learning curve, but you have a lot more > freedom. And of course node is much more powerful in terms of handling > zillions of connections at once. > > I'm sure you will find tons of facts if you google "nodejs versus php". > Or, better yet, study tutorials for each. > > > On Wed, Nov 28, 2012 at 3:46 PM, Sean <[email protected] > <javascript:>>wrote: > >> Hey all, has anyone found a good feature/comparison matrix between >> node.js vs php? We're trying to decide which way to go and there's a lot of >> emotional argument on either side but I can find little fact. >> >> Thanks in advance! >> >> >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> You received this message because you are subscribed to the Google >> Groups "nodejs" group. >> To post to this group, send email to [email protected]<javascript:> >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> > > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
