Php Equivalent For Node.js ?
#1
Posted 13 October 2012 - 01:25 PM
Apache is not good for this because of the persistent connections.
node.js is awesome for this - but it's Javascript.
I like postgresql (which I prefer to interface with via PDO), I like php, I like to keep the server side of things all in one language if I can.
I've found node.js interface to MySQL but it really looks like node.js database layers are bolt on and not that mature yet.
Is there a good web server for maintaining lots of connections that runs php?
#2
Posted 13 October 2012 - 02:44 PM
Apache is not good for this because of the persistent connections.
1) Why is that bad? 2) Why not simply send
Connection: close upon each request instead of telling it to persist? 3) Would nginx be an option? It uses FastCGI?
Edited by ignace, 13 October 2012 - 02:47 PM.
#3
Posted 13 October 2012 - 03:39 PM
The point of Server Sent Events is that the web server can send messages to the browser without the browser needing to request them. If the connection is broken, the browser re-connects with the ID of last message it received so that it can get any messages it missed. It allows web applications that need server push capabilities to work without using flash or java - and without frequent polling that can be very hard on the server.
I don't know if nginx is an option or not, I've not used it.
#4
Posted 13 October 2012 - 03:56 PM
That said, if your Apache install is running out of threads you're either configured it wrong, written some bad code, or you have a huge number of unique visitors. I suspect that the first two scenarios are the most likely ones.
#5
Posted 13 October 2012 - 07:21 PM
node.js is awesome for this - but it's Javascript.
I'm not sure I see the point here. Javascript is an awesome language that should be known by all web developers IMO.
node.js database layers are bolt on and not that mature yet.
Just like PHP, everything in node is an extension library, and yeah, a lot of this stuff is pretty new. Node.js is however advancing really quickly and there are a lot of real smart dudes working on / with it.
http://thorpesystems.com | http://proemframework.org | http://github.com/trq
SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
#6
Posted 14 October 2012 - 02:07 AM
Of course the web developer needs to know Javascript for the client side programming, but the client side programming doesn't interface with server resources directly, it sends those as requests to the web application.
If I have to do that part of the web app in node.js I'll do it in node.js but I would prefer to do it in php because the rest of the web app (a social network platform) is php. What I'm trying to do is leverage the power of html5 to remove all use of plugins. I hate browser plugins with a passion. Probably from my days running ppc linux where there were none so any site that required them was broken, but hell, I even hate dependence upon them in Windows. To keep everything server side php is why I'm seeking a php capable http server that does not have the same persistent connection limitations of Apache.
#7
Posted 14 October 2012 - 02:40 AM
https://aoeex.com/chat/phpchatd.phps is a example I made a while back that uses the principal above. It acts as a simple server that handles all the long-poll connections for a AJAX chat room. The demo chat room that uses it is at https://aoeex.com/chat/chat.html.
Did I help you out? Feeling generous? I accept tips via Paypal or Bitcoin @ 14mDxaob8Jgdg52scDbvf3uaeR61tB2yC7
#8
Posted 14 October 2012 - 03:06 PM
#9
Posted 14 October 2012 - 03:40 PM
Edited by Mahngiel, 14 October 2012 - 03:41 PM.
CodeIgniter Libraries: Image Lib | Paginator Lib | AJAX UploadWhat do you mean "so please write the code for me . . . "? We aren't here in gleeful anticipation just waiting to write code for you, you know.
#10
Posted 14 October 2012 - 07:55 PM
#11
Posted 21 October 2012 - 09:29 PM
#12
Posted 29 December 2012 - 02:34 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











