Keep in mind that PHP is a web scripting language by nature (despite what the PHP group might want us to think :-)
Keeping that in mind, there are a variety of defaults in PHP that you might need to fiddle with. In this case, my guess would be that you have a timeout in place that limits the amount of time that a PHP script can run for. This default was put in place because of the nature of PHP and the normal useage....a web script probably shouldn't run for hours, and if it does then there is probably an error in the script. If there is an error, why let it slam on the box for hours and stop other good scripts from working? Just let it die now and keep the box running.
This default can be changed within the php.ini file, so check out the online documentation and try changing this value. This may fix your problem.