It was driving me crazy that the script was killed couple of hours after I logged out, even I started it as:
php server.php >& logfile.txt
looks like PHP somehow interact with standard input, even I do not used it.
Solution was to start it with nohup:
nohup php server.php >& logfile.txt
or to do demonize / run as demon (e.g. fork() and close file descriptors)