2

I use PHP exec() function to make system calls on windows env.

Now, I want to make sure that if i make a call, it doesnt go on forever. I want to kill the process after $x seconds. For example:

exec('2.exe');

If 2.exe runs for more than 15 seconds, kill 2.exe.

How can I do this with PHP?

Brad
  • 159,648
  • 54
  • 349
  • 530
user1233459
  • 21
  • 1
  • 2
  • possible duplicate of [Maximum execution time of 60 seconds exceeded](http://stackoverflow.com/questions/2202355/maximum-execution-time-of-60-seconds-exceeded) – Brad Feb 26 '12 at 06:34
  • http://stackoverflow.com/questions/1176497/limit-execution-time-of-an-function-or-command-php – Brad Feb 26 '12 at 06:36
  • 1
    possible duplicate of [How can I enforce a time limit on a call to `exec()`?](http://stackoverflow.com/questions/9128938/how-can-i-enforce-a-time-limit-on-a-call-to-exec/9128994#9128994) - which explains actual ways to constrain exec. – mario Feb 26 '12 at 09:06
  • already went through those posts.. the set_time_limit doesnt seem to work.. and i'm not very sure how to use proc functions.. – user1233459 Feb 26 '12 at 13:59
  • What is your operating system? Windows? – galymzhan Feb 26 '12 at 20:30

0 Answers0