ID:               27865
 Updated by:       [EMAIL PROTECTED]
 Reported By:      bernard at kuantic dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         Filesystem function related
 Operating System: Linux Fedora Core 1
 PHP Version:      5.0.0RC1
-Assigned To:      
+Assigned To:      wez


Previous Comments:
------------------------------------------------------------------------

[2004-04-05 06:07:44] bernard at kuantic dot com

Description:
------------
Hello.



I'm trying to run a php script from xinetd (Fedora Linux). I need to
close stdin, stdout & stderr since I want to close the socket
established with the caller process (I have a long processing to do
locally, I need to release a remote resource & closing the connection
is the only way I can do it).



I've tried :



fclose(STDIN); fclose(STDOUT); fclose(STDERR);



It does not work, the socket is still up & running.



When I run strace(1), I see that I'm closing fds 4, 5 & 6 (fd 3 is the
fd of the script being read) and not fd 0, 1 & 2.



It seems that CLI PHP calls dup(2) to get duplicates of fd 0, 1 & 2 and
so these 3 fds are totally unreachable from the script itself.



I'm not used to php source code, but I think that the problem comes
from getting constants STDIN, STDOUT & STDERR thru filter code
generation used by "php://stdin" etc. and no provision is done for the
first calls:

a dup(2) is automatically used.



So constants STDIN, STDOUT & STDERR are not pointing to the correct
fd's, but dup's.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27865&edit=1

Reply via email to