А по-другому как-нибудь можно?php.net написал(а):pcntl_sigtimedwait
(PHP 5 >= 5.3.0)
?считать сколько времени ты его селектишь в сумме
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<title>Проверка прерывания процесса</title>
</head>
<body>
<?php
$pipes = array();
$descriptorspec = array(
0 => array('pipe', 'r'), // stdin is a pipe that the child will read from
1 => array('pipe', 'w'), // stdout is a pipe that the child will write to
2 => array("file", "error.txt", "w") // stderr is a pipe the child will write to
);
$command = '"C:\www\proverka\Proverka3.exe"';
$process = proc_open($command, $descriptorspec, $pipes);
$write = array();
$read = array($pipes[0]);
$except = null;
$start = microtime(true);
stream_select($read, $write, $except, 10);
$time_passed = microtime(true) - $start;
print $time_passed;
if ($time_passed > 10)
die("Всё пропало");
?>
</body>
</html>
что именно тебе непонятно?int stream_select ( array &$read , array &$write , array &$except , int $tv_sec [, int $tv_usec = 0 ] )
The tv_sec and tv_usec together form the timeout parameter.
The timeout is an upper bound on the amount of time that stream_select() will wait before it returns.
<?php
exec("perl proverka.pl");
?>
#!/usr/bin/perl
use Win32::Process;
$ProcessObj;
$workdir = "C:\\www\\proverka";
$appname = "$workdir\\Proverka.exe";
$cmdline = "$workdir\\Proverka.exe";
Win32::Process::Create($ProcessObj, $appname, $cmdline, 0, DETACHED_PROCESS, $workdir);
$ProcessObj->Wait(10000);
$ProcessObj->Kill($exitcode);