Forum Moderators: coopster

Message Too Old, No Replies

exec() and maximum execution time

How to set maximum execition time of exec()

         

wieza

10:08 pm on Apr 25, 2006 (gmt 0)

10+ Year Member



Hi. Is it possible to set maximim execution time of exec($shellCommand) funcntion? Sometimes execution of my $shellCommand lasts too long and e.g. after 1min i would like to stop execution and do next lines of my php file.

eelixduppy

11:05 pm on Apr 25, 2006 (gmt 0)



Maybe

set_time_limit(int seconds);?

eelix

IanKelley

7:10 am on Apr 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



After you run the shell application run a loop to test it's return status and elapsed time. If it doesn't return what you're looking for in X seconds, kill the process.

To be considerate of server resources do a short sleep at the beginning of every loop.

Also look at passthru()