php5-fpm - RecursiveIteratorIterator和RecursiveDirectoryIterator

I have a script that I want to create an array of all files and folders within a specific directory.

However, I have a problem. This setup worked perfectly on an Apache2 + php5 installation but I recently switched over to nginx + php5-fpm and now this script does not work.

The RecursiveIterator function is called without any errors but returns an empty array.

$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->path));

var_dump($files);
die;

The error it outputs is:

object(RecursiveIteratorIterator)#218 (0) { }

I've looked around and there's no answer for this. Does my setup require another package to be installed?