Re: pcntl_fork behavior with php version 5.1.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


development os is Debian GNU/Linux 6.0
test os is SUSE LINUX 10.1 (i586)

Am 29. März 2012 23:02 schrieb Jim Lucas <lists@xxxxxxxxx>:

> On 03/29/2012 12:49 PM, Ralf Gnädinger wrote:
>
>> Hi,
>>
>> i got some trouble with a PHP script using pcntl_fork do run some work in
>> background.
>> Runnig my script on my development system (PHP version 5.3.3-7) it behaves
>> like
>> intended. But running it on my production test system (PHP version PHP
>> 5.1.2), i got
>> some strange results. The problem is, that when i logout from my SSH
>> session the
>> console closes not properly, like somethings is kept open. Sadly, updating
>> this old PHP
>> version is not a option... :/
>>
>> Does anyone have an idea whats going on?
>>
>> Thanks in advance
>>
>> Ralf
>>
>> The script is this:
>>
>> #!/usr/bin/env php
>> <?php
>>
>> $pid = pcntl_fork();
>> if ($pid == -1) {
>>      die('Fork failed!');
>> } else if($pid>  0) {
>>
>>     exit(0); // close parent process
>>
>> } else { // child process:
>>
>>     while(true) {
>>         sleep(10);
>>         // do your work -- stripped
>>     }
>> }
>> ?>
>>
>> do not work with:
>> PHP 5.1.2 with Suhosin-Patch 0.9.6 (cli) (built: Dec 12 2007 02:42:35)
>> Copyright (c) 1997-2006 The PHP Group
>> Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
>>
>>
>> works with:
>> PHP 5.3.3-7+squeeze3 with Suhosin-Patch (cli) (built: Jun 28 2011
>> 08:24:40)
>> Copyright (c) 1997-2009 The PHP Group
>> Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
>>     with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
>>
>>
> This sounds more like an OS issue then a PHP issue.
>
> What are the two OSs involved?
>
> --
> Jim Lucas
>
> http://www.cmsws.com/
> http://www.cmsws.com/examples/
> http://www.bendsource.com/
>

[PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [Find Someone]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux