title: PHP SIGTERM in CLI
body: <p>I'm running php scripts from CLI, and i'd like to execute a function when script stopped with ctrl + c. I tried this:</p>
  
  <pre><code>&lt;?php
  
  declare(ticks = 1);
  
  function sigint() {
      echo 'This is the end';
      exit;
  }
  
  pcntl_signal(SIGTERM, 'sigint');
  
  $i = 1;
  
  do {
  
      echo $i++ . ' ';
  
      sleep(1);
  
  } while (TRUE);
  </code></pre>
  
  <p>but it doesn't works. How can i do this?</p>