I was told this:
The glob() function returns false if there is an error, and that would cause foreach to give that error. It’s possible that the TEMPLATEPATH constant isn’t defined for some reason, or the “includes/custom_functions” directory doesn’t exist there. If neither of those things are the problem, it’s also possible that the user that PHP scripts runs under isn’t able to read from the directory due to filesystem permissions.
This is how I fixed the problem:
I just changed line to this:
//foreach (glob(TEMPLATEPATH.”/includes/custom_functions/*.php”) as
$filename) { include $filename; };
so it would not call that particular function and the site works perfectly.