Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #7545
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: php daemon |
| Date | 2012-11-13 07:47 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <k7tfi3$mpb$1@dont-email.me> (permalink) |
| References | <k7omm2$lbq$1@news.albasani.net> <k7sugc$vj2$1@news.metronet.hr> |
On 11/13/2012 2:57 AM, Goran wrote:
> On 11.11.2012 18:18, sl@exabyte wrote:
>> Anybody has experience of running php program as daemon ?
>>
>> Would explicitly allocating and de-allocating all variables/memories be
>> effective for managing php daemon ?
>
> PHP daemons are common pattern in some situations. E.g. how would you
> implement AMQP listener without daemon?
>
I'd do it in C or C++.
> But, due to the stateless nature of web, PHP is not made for daemonizing
> :) Fortunately, there is solution, just keep in mind the following:
>
It has nothing to do with the stateless nature of the web. PHP is good
for non-web projects, also. And C and other languages can be used for
the web.
> 1. don't overuse this possibility - avoid it if you can
> 2. don't depend on PHP's memory management - shutdown your script
> automatically from time to time just to be safe of memory leakage
> 3. auto start it immediately after shutdown - use supervisord
>
> Basically, do this:
>
> <?php
>
> define('MAX_ITERATIONS', 10);
>
> for ($iteration = 0; $iteration < MAX_ITERATIONS; $iteration++)
> {
> // Do something nasty
> // ...
>
> sleep(10);
> }
>
> ?>
>
What a kludge.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
php daemon "sl@exabyte" <sb5309@hotmail.com> - 2012-11-12 01:18 +0800
Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-11 14:04 -0500
Re: php daemon Christoph Becker <cmbecker69@gmx.de> - 2012-11-11 21:05 +0100
Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-11 15:35 -0500
Re: php daemon Christoph Becker <cmbecker69@gmx.de> - 2012-11-11 22:22 +0100
Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-11 16:36 -0500
Re: php daemon Christoph Becker <cmbecker69@gmx.de> - 2012-11-11 23:17 +0100
Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-11 18:11 -0500
Re: php daemon Christoph Becker <cmbecker69@gmx.de> - 2012-11-12 14:35 +0100
Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-12 08:38 -0500
Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-13 07:44 -0500
Re: php daemon Christoph Becker <cmbecker69@gmx.de> - 2012-11-14 21:19 +0100
Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-14 16:33 -0500
Re: php daemon Christoph Becker <cmbecker69@gmx.de> - 2012-11-14 23:13 +0100
Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-15 07:41 -0500
Re: php daemon Christoph Becker <cmbecker69@gmx.de> - 2012-11-15 16:55 +0100
Re: php daemon "sl@exabyte" <sb5309@hotmail.com> - 2012-11-12 23:45 +0800
Re: php daemon The Natural Philosopher <tnp@invalid.invalid> - 2012-11-12 16:08 +0000
Re: php daemon Goran <goran@nospam.com> - 2012-11-13 08:57 +0100
Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-13 07:47 -0500
Re: php daemon Goran <goran@nospam.com> - 2012-11-13 14:54 +0100
Re: php daemon The Natural Philosopher <tnp@invalid.invalid> - 2012-11-13 14:13 +0000
Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-13 12:23 -0500
Re: php daemon Goran <goran@nospam.com> - 2012-11-14 08:43 +0100
Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-14 05:51 -0500
Re: php daemon Goran <goran@nospam.com> - 2012-11-15 14:08 +0100
Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-15 08:46 -0500
Re: php daemon Goran <goran@nospam.com> - 2012-11-15 16:09 +0100
Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-15 11:25 -0500
Re: php daemon Tim Streater <timstreater@greenbee.net> - 2012-11-15 16:20 +0000
csiph-web