- readlink: documentation ( source)
- print_r: documentation ( source)
- stream_get_meta_data: documentation ( source)
- fopen: documentation ( source)
<?php
$mfd = array();
$it = new DirectoryIterator("glob:///proc/self/fd/*");
foreach($it as $f) {
$tmpArr = array();
$tmpArr['fd'] = $fd = fopen("php://fd/" . $f->getFilename(), 'r+');
$details = stream_get_meta_data($fd);
$tmpArr['type'] = $details['stream_type'];
$tmpArr['state'] = $details['blocked'];
$tmpArr['uri'] = $details['uri'];
$tmpArr['mode'] = $details['mode'];
$tmpArr['filepath'] = readlink('/proc/self/fd/' . $f->getFilename());
$mfd[ $f->getFilename() ] = $tmpArr;
}
print_r($mfd);