One of the key things to keep in mind is that the real-time web server server must be โlongโ so that it can push information to clients. In the classic LAMP setup, Apache runs a PHP interpreter for each request. Between requests, the PHP interpreter does not work, and the only state of the protocol between requests is a session.
One of the nice features of the LAMP method is that memory management is easy. You simply implicitly allocate the memory you need, and it is automatically restored after the request is completed, and the PHP process ends. As soon as you want the server to continue to work, you need to consider memory management. In some languages, like C ++, you control the allocation and release explicitly. In other languages, such as Java or Javascript, you have garbage collection. In PHP, you drop everything and start with a fresh slate for every request.
I think it will not be easy for you to make servers with long servers with something like Cake or any other classical PHP framework. This framework works mainly by using an HTTP request and turning it into an HTTP response.
My advice is that you should learn something like Node.JS and SocketIO. If you know Javascript or do not mind learning, these technologies will allow you to easily implement real-time servers and clients. If necessary, you can run a reverse proxy, such as nginx, so that your existing LAMP stack receives some requests, and one or more NodeJS servers can receive some.
This answer came out a bit fluffy, but I hope this helps a little .. :-)
Weston
source share