<?php
$fd = fopen('/etc/passwd', 'r');
echo "$fdn";
fclose($fd);
$fd = fopen('/etc/fstab', 'r');
echo "$fdn";
fclose($fd);
?>
And this shows the usual:
$ php fds.php
Resource id #5
Resource id #6
Python doesn't have this problem though.
PHP is reusing the file descriptors but counting up its file resource. When it gets to 2^31-1 files and then goes into negative numbers and when it gets to 0 it crashes. How can the process use that many file handles in a few weeks time?
How do you reuse old file descriptors or resources after they are closed so you can run the php script forever?
No comments:
Post a Comment