PHP "failed to open stream - too many open files" error

I'm getting the PHP error

failed to open stream: Too many open files.

I suspect the problem is that I'm not closing something properly, but to find out what, I need to get a list of currently open files when this error occurs. How do I find this information? This is on a shared Apache server.