Could anybody explain me why I have this behavior and if it is attributable
to a misconfiguration of php?

This doesn't look like a PHP misconfiguration. It looks more like an
application-level issue. Do a grep for "realpath" in your application
code. A single call to realpath() would cause that tree of stat calls
you see. Also, you might be overflowing your realpath cache. PHP 5.2
is not using the cache very efficiently. This is fixed in 5.3. But try
increasing your cache ttl and the size as well. eg.