Welcome Guest, Not a member yet? Register   Sign In
Advice on writing Daemon in PHP/CI or ?
#5

(03-05-2018, 10:13 AM)richb201 Wrote: Hey Dave. I guess what I most concerned with about using PHP/CI is the spawning. Does each time an ajax message comes into the server, a brand new  copy of the PHP code (ie, a process) is spawned? Thus this is a multiprocess solution, which might be OK, except that I'd be concerned about the time it takes to load a new copy of the process from the disk. Thanks for bringing a little sanity into my plan!

An AJAX message is just a regular HTTP request that's hidden by the browser and executed behind the scenes. And yes, each request spawns a new PHP process. In this scenario, Apache is your deamon.

But that shouldn't be much of a concern - most of the internet runs like that and it works just fine.

I would recommend nginx+php-fpm for higher performance and overall a better environment (people are so used to Apache that few have a reason to look for alternatives, but nginx is objectively a superior httpd). In that scenario, php-fpm will be the deamon spawning workers and unlike Apache+mod_php, it actually has all PHP extensions preloaded, so that's a significant boost.

If you really want to write your own deamon in PHP, I'd look into Amp, Aerys and/or ReactPHP - those are basically the PHP answer to Node.js.
Reply


Messages In This Thread
RE: Advice on writing Daemon in PHP/CI or ? - by Narf - 03-09-2018, 06:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB