in php3.ini/php.ini look for:
max_execution_time = 30 ; Maximum execution time of each script, in seconds
for apache in httpd.conf:
Timeout: The number of seconds before receives and sends time out.
Timeout 300
If your script is taking that long to execute there is probably a better way to write the script.
brandon