Jump to content

How to trigger and control a timeout?


barbapapa

Recommended Posts

Hi,

 

is there a way to set a timeout before executing a mysql query (or something else), e.g

<?php

function timeoutfunc() { echo 'timeout triggered!'; }
...
set_code_execution_timeout('45 seconds',  timeoutfunc);

mysql_query ('long query'...);
...
?>

 

This would trigger a timeout and call timeoutfunc() if exec time of query is > 45 seconds.

Of course the function set_code_execution_timeout() doesn't exist.

 

- is there a way to do the same thing?

- maybe using exceptions?

 

Thank you.

 

bbpp

Link to comment
https://forums.phpfreaks.com/topic/109145-how-to-trigger-and-control-a-timeout/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.