My script compares 2 source trees, creates a map of possible changed files, compares MD5 hashes and creates a diff-package.
After 28000-29000 files, PHP terminates t
Try set_time_limit() and check in phpinfo() if you are able to set the time limit:
set_time_limit(60*60);phpinfo();exit;