I already changed the max execution time.
set_time_limit(600);
but it stills times out after a minute or so... is there some other settings i should change?
Add set_time_limit to sections of your code that loop ... preferably the ones that are taking the most time.