RecursiveIteratorIterator does not work - php5-fpm

Posted April 27, 2015 4k views
UbuntuPHPPHP FrameworksControl Panels


I am trying to use RecursiveIteratorIterator with RecursiveDirectoryIterator to return an array of recursive files and folders.

This used to work on a Apache2 + php5 setup but I recently moved over to nginx and php5-fpm.

Everything on my site works perfectly except this particular function.

I do a var_dump on the variable those 2 functions are set on and it returns:

object(RecursiveIteratorIterator)#218 (0) { }

I dunno what’s wrong or if I’m missing a particular php5 package that’s suppose to be installed.

Anyone have any ideas?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi! RecursiveIteratorIterator is part of the base php5 package so it should be there by default. Are you getting any errors? Check nginx’s error log:

sudo tail /var/log/nginx/error.log
  • Firstly, thanks for the response. I appreciate it.

    Secondly, I forgot that Laravel had a FileSystem API, so just calling Files::allFiles() was far easier.

    I’ll be taking a look at nginx’s error logs to see where I went wrong.

    Thank you.