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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to