Advertisement
mikjaer

Untitled

Sep 1st, 2021
1,289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. root@planway:/var/www/demo.planway.com/htdocs# cat shutdown_handler.php
  2. <?php
  3.  
  4. $timer = time();
  5.  
  6. function writelog($str)
  7. {
  8.     $fh = fopen("/var/www/demo.planway.com/htdocs/logfile.log","a");
  9.     fputs($fh, $str."\n");
  10.     fclose($fh);
  11. }
  12.  
  13. function shutdown()
  14. {
  15.     global $timer;
  16.  
  17.     $etime = (time() - $timer);
  18.  
  19.     print "Execution took $etime<br>";
  20.  
  21.     if ($etime > 4)
  22.     {
  23.         writelog(" ---- Request took $etime\n".print_r($_SERVER,true));
  24.     }
  25.  
  26.     echo 'Script executed with success', PHP_EOL;
  27. }
  28.  
  29. regis
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement