On Wed, Nov 30, 2011 at 12:58:26PM +0100, richard gray wrote:
> On 29/11/2011 17:16, Daniel Brown wrote:
> >On Sat, Nov 19, 2011 at 09:33, richard gray<r...@richgray.com>  wrote:
> >This happens because PHP is writing to STDOUT, of course, and then the 
> >command line redirection grabs that information and puts it into the 
> >file. Unfortunately, by itself, this won't work in the background, 
> >which is why you're getting the SIGTTOU (SIGnal TTy OUput). If you 
> >need to redirect the output and have it run in the background (where 
> >something like file_put_contents() or fwrite() isn't a practical 
> >option), give it a NOHUP (NO Hang-UP): nohup php test.php > test.log & 
> >This will automatically redirect STDERR to STDOUT, save for the 
> >message telling you the same. 
> 
> Thanks for your reply Daniel unfortunately nohup makes no difference the 
> script still stops with no output being logged -- and also on a 
> different machine (Ubuntu) php -f test.php >test.log 2>&1 & -- works 
> perfectly - seems to be an issue with OSX Lion and the version of PHP 
> that came with the machine -- I cannot compile my own build of PHP 
> because of this problem -> https://bugs.php.net/bug.php?id=60268 -- so I 
> am completely stuck :(

The point is that you need to completely disassociate the process from the tty.
Install the daemonize program, then use it to run your PHP script. See:

        http://software.clapper.org/daemonize/

It claims to run under OSx (which is just BSD Unix).

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT 
Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: 
http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to