I have a PHP4.3.4 script on an IIS5 webserver that runs a series of queries on a remote Oracle Rdb7 database server. Execution time is typically less than 5 seconds but recently, due to a combination of issues that will take some time to sort out, execution can take up to 100 seconds. In the meantime, I would like to prevent a blank or incomplete page from being displayed if max execution time is exceeded. I have extended the max execution time to 120 seconds but what I want to do is display a friendly message (network congestion - try again later) if query cannot be completed in a reasonable time (30 seconds).
I have tried a user-defined error handler function but for some reason, max execution errors aren't getting picked up. The script halts, the output buffer is flushed, and I get an incomplete page sent to the browser which is just the script output to that point.
Here is the query and error trigger:
<pre>$query = odbc_exec($connectionstring, $sql) or trigger_error("Error - query could not be executed.",E_USER_ERROR);
</pre>
Any ideas what I am missing? What needs to be done to capture max execution errors and take appropriate action?
Thanks for your input.