NYCPHP Meetup

NYPHP.org

[nycphp-talk] system() call timeout

Steve Manes smanes at magpie.com
Wed Oct 12 12:41:55 EDT 2005


Jeffrey O. Stevison wrote:
> Is there a way to set a timeout value for a system("ls -l") call?  If  
> the ls command hangs for at least 5 secs I want to term the call and  
> have some return value that indicates the process has termed.

I've never tried it with PHP but I used external process timers in C 
programs by setting a function on the SIG_ALRM signal.  The function 
would send a kill to the PID of the child process when alarm() timed out.

You might find what you need here:

   http://us3.php.net/manual/en/function.pcntl-signal.php



More information about the talk mailing list