Reputation: 21759
I don't quite get what is the difference between Nginx and Apache?
I want to use PHP Comet technique for the chat. I do like that:
while($modification_date == filemtime($filename)) {
sleep(2);
}
//$filename was updated and we retrieve new messages and give them to the user with JSON help
It of course doesn't work in Apache. Will it work in Nginx?
Do not offer me NodeJS and other, please.
Upvotes: 0
Views: 2607
Reputation: 44124
Nginx
doesn't automagically make that code work. It will suck equally as bad as it did in Apache. The main problem is that PHP isn't threadsafe and each request needs one forked PHP proc to handle the request. This translates into insanely large amounts of needed RAM to scale to anything of decent size. Nginx
can get around this problem by a different style of programming (comet) and the help of an extension.
Upvotes: 1
Reputation: 7748
Main difference between Apache
and Nginx
is one is thread driven and another is event driven. But, I think your question is not clear. They have nothing to do with your code snippet. And first explain why It'll not work in Apache
.
Upvotes: 2