0

I have a php applicacion to repair. The boss's solution is to restart the server each time the app fails. He wants to run a script when the page spends 30 seconds or more loading. How can I run the script when the execution time is up to 30s? Thanks in advance.

  • possible duplicate of [Call a function before the page is timeout in PHP](http://stackoverflow.com/questions/6759446/call-a-function-before-the-page-is-timeout-in-php) – jeroen May 08 '14 at 15:29

1 Answers1

0

I believe you should be able to use register_shutdown_function

set_time_limit(1);

function test() {
    echo "Processing timeout";
}

register_shutdown_function('test');

while(1);
mister martin
  • 6,197
  • 4
  • 30
  • 63
  • Thanks, that works. But it just should do it when the time is reached, else it should load the page. Anyway this help me a lot. Thank you – user3358023 May 09 '14 at 08:44