[nycphp-talk] system() call timeout
Hans Zaunere
lists at zaunere.com
Wed Oct 12 22:42:20 EDT 2005
Jeffrey O. Stevison wrote on Wednesday, October 12, 2005 11:42 AM:
> 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 tested this for this type of use, but perhaps proc_open() or
popen() could help. You'd get some streams, which you could then set
timeouts on for reading. It might be a little tricky to code, and may not
even work, but could be worth a shot.
The real question, however, is why an ls is taking so long. If the same ls
doesn't take long in the shell, then it's likely some other issue in the PHP
application.
---
Hans Zaunere / President / New York PHP
www.nyphp.org / www.nyphp.com
More information about the talk
mailing list