if i have a php background job, may need to run 4-5hours or more will it cause exception on memory_limit
PHP has a very primitive memory manager and scripts are not designed to run for very long. You can update the memory limit like this:
<?php ini_set(“memory_limit”,”256M”); ?>
But you will probably still have memory problems. You could try adding a ton of unset()'s to your script and this can help a bit. But the memory leaks are probably in PHP and its C/C++ extensions which you can't control. In the past I have had to rewrite background tasks in Java.