PHP SplFileInfo: "Too many open files"

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....
Post Reply
User avatar
peter_b
Chatterbox
Posts: 371
Joined: Tue Nov 12, 2013 2:05 am

PHP SplFileInfo: "Too many open files"

Post by peter_b »

[PROBLEM]
Storing clones of SplFileInfo objects in an array to sort them, throws the following error:
failed to open dir: Too many open files in [...]
[SOLUTION]
If only I had seen Ken Snyder's comment on PHP DirectoryIterator's documentation page before:
Don't store DirectoryIterator objects for later; you will get an error saying "too many open files" when you store more than the operating system limit (usually 256 or 1024).
Post Reply