note 49172 added to function.exec
| From: | layton at layton dot tk | Date: | Tue, 18 Jan 2005 23:52:58 +0000 |
| Subject: | note 49172 added to function.exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-83592@lists.php.net to get a copy of this message | ||
This is the second time this one got me, I thought someone else might find this note useful too.
I am creating a long running exec'd process that I can access with page submissions up to 2
hours later. The problem is this, the first time I access the page everything works like it should.
The second time the web browser waits and waits and never gets any messages -- the CPU time is not
affected so it is apparent that something is blocked.
What is actually happening is that all of the open files are being copied to the exec'd process
-- including the network connections. So the second time I try to access the web page, I am being
given the old http network connection which is now being ignored.
The solution is to scan all file handles from 3 on up and close them all. Remember that handles 0,
1, and 2 are standard input, standard output, and standard error.
----
Manual Page -- http://www.php.net/manual/en/function.exec.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49172
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49172&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49172&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49172&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49172&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49172&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49172&report=yes
Search -- http://master.php.net/manage/user-notes.php