1--TEST-- 2Test posix_kill(), posix_get_last_error and posix_strerror() functions : basic functionality 3--SKIPIF-- 4<?php 5 if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); 6?> 7--FILE-- 8<?php 9 echo "Basic test of POSIX getpgid(), kill(), get_last_error() and strerror() functions\n"; 10 11 // Don't rely on PCNTL extension being around 12 $SIGKILL = 9; 13 14 // TODO Once we have PS open working beef up this test to create a process and kill it 15 // for now start at a low pid and find first pid which does not exist. 16 $pid = 999; 17 do { 18 $pid += 1; 19 $result = shell_exec("ps -p " . $pid); 20 } while (stripos($result, (string)$pid) != FALSE); 21 22 echo "Kill pid=" . $pid . "\n"; 23 var_dump(posix_kill($pid,$SIGKILL)); 24 25 $errno = posix_get_last_error(); 26 27 var_dump($errno); 28 var_dump(posix_strerror($errno)); 29 30?> 31===DONE==== 32--EXPECTF-- 33Basic test of POSIX getpgid(), kill(), get_last_error() and strerror() functions 34Kill pid=%d 35bool(false) 36int(%d) 37string(%d) %s%rNo such process|Operation not permitted%r%s 38===DONE==== 39 40