title: How do I stop a PHP script running on the background
body: <p>I started this process (time.php)</p>
  
  <pre><code>&lt;?php
  
  ignore_user_abort(true); // run script in background
  set_time_limit(0);       // run script forever 
  $interval = 300;         // do every 1 minute...
  do
  { 
      // add the script that has to be ran every 1 minute here
      // ...
  
      $to      = "xxxxxxxxx@gmail.com";
      $subject = "Hello Richie";
      $header  = "From: me@xxxxxxxxx.org";
      $body    = "Hello Richard,\n\n"
               . "I was just testing this service\n\n "
               . "Thanks! ";
  
      mail($to, $subject, $body, $header);
  
      sleep($interval); // wait 5 minutes
  
  } while(true); 
  ?&gt;
  </code></pre>
  
  <p>but I now want to stop it. It's sending hundreds of mail to my Gmail a/c. It's on a web server where I cant restart it to kill the process.</p>
  
  <p>Is there a way to execute another file to kill the process, or how do I go about?</p>