I’d like to include an already opened file. As include wants a filename this seems untrivial.
The only thing I can find on http://php.net/manual/en/wrappers.php.php is to somehow coax the file descriptor out of the return value of fopen and use php://fd/$fd. I can’t get any further.
Edit: apparently it is not clear, I would like to reuse the file descriptor and not reopen the file.
This might work for you. Depending on how the stream was opened, it might return either the full path name or just the base name, so you’ll probably have to do some munging to check and make sure the right path is supplied. (Or the script is run from the correct directory.)