2

Currently I am using

$pid = getmypid();
exec("kill $pid");
exec("TSKILL $pid");

Is there a better, generic way?

Edit: exit runs destructors and shutdown functions. As the title suggests, I am testing and want to terminate immediately.

chx
  • 11,270
  • 7
  • 55
  • 129
  • 1
    What is your testing trying to achieve? – Ed Heal Sep 12 '15 at 05:04
  • @icecub How is that generic when http://php.net/manual/en/intro.posix.php says "This extension is not available on Windows platforms." I thought the `TSKILL` in the question showed the need for Windows, sorry for not elaborating. – chx Sep 12 '15 at 05:21
  • @chx Right, my mistake. Sry man – icecub Sep 12 '15 at 05:21
  • @chx probably because it might not work on iis servers but don't know for sure as I have no experience with it – SuperDJ Sep 12 '15 at 05:23
  • 2
    possible duplicate of [How to exit a PHP script without calling the destructor?](http://stackoverflow.com/questions/11302226/how-to-exit-a-php-script-without-calling-the-destructor) – uri2x Sep 12 '15 at 06:52
  • Possible duplicate? Perhaps. Except I have a solution for that question, maybe not the most elegant but it certainly works. Should I move the question into an answer there? – chx Sep 12 '15 at 09:21

0 Answers0