In a matter of minutes, and without being able to gather data to understand what might be behind it, I get the following error:
RecursiveDirectoryIterator :: __ construct (path / to / directory) [recursivedirectoryiterator .-- construct]: failed to open dir: Too many open files
The server where this error occurs is running Apache / 2.2.24 and PHP / 5.3.22.
$workingPath = "caminho/para/directoria";
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($workingPath),
RecursiveIteratorIterator::SELF_FIRST
);
$files = iterator_to_array($iterator, true); /* tentativa de abafar o erro
como sugerido num tópico do SOEN
mas sem sucesso em resolver a questão */
foreach ($files as $file) {
// código a executar por cada ficheiro localizado
}
Question
How can I correctly evaluate the cause of this error and / or find out if there are any limits that I do not know could be causing the same?