Mystery error

Topics: Developer Forum, User Forum
Mar 6, 2009 at 2:20 PM
I have created the following simple bit of code for taking a user uploaded xlsx file to be converted to csv so that it can be easily read by my java applet. 

                ini_set("display_errors", 1);
                ini_set('include_path', '/vh/docroots/');
                include 'PHPExcel.php';
                include 'PHPExcel/Reader/Excel2007.php';
                include 'PHPExcel/Writer/CSV.php';
                $objReader = new PHPExcel_Reader_Excel2007();
                $objPHPExcel = $objReader->load("$userfile");
                $objWriter = new PHPExcel_Writer_CSV($objPHPExcel);

However, I keep getting the following error:

Fatal error: Class 'IteratorIterator' not found in /vh/docroots/ on line 48

Has anyone else encountered this issue and have a fix perhaps?

Many thanks for any help.

Mar 7, 2009 at 12:06 AM
Can you check with phpinfo() that you have not disabled SPL ?

You should be seeing something like this:

May 14, 2009 at 1:06 PM

Hi !

I've the same error but SPL is enable in phpinfo()...

I'm using EasPHP to develop my website in local...

Does it make something???

Have you find an answer??


Thanks !


May 14, 2009 at 1:42 PM

@Kei: What do you get when you run this?

var_dump(class_exists('IteratorIterator', false));


It should give "true" for PHPExcel to work correctly.


May 14, 2009 at 1:46 PM

It gives me :


So i think it cant work correctly... ^^ Have you got a solution??

Thanks a lot!

May 14, 2009 at 1:57 PM

I think something is not working correctly with your EasyPHP. Do you see IteratorIterator in that SPL box when you use phpinfo() ?

Can you also test on some other host and compare? I have never tried EasyPHP.


May 14, 2009 at 2:49 PM

I'm so stupid.... I've made a mistake

I'm developping 2 website at the same time, and this one is online on, and in their phpinfo() SPL is enable but IteratorIterator is not present...

So is there is any solution ??? Or i just have to find another way to make xls?


May 14, 2009 at 3:16 PM

Temporarily, you can downgrade to PHPExcel 1.6.5 which does not depend on this.

Try to write this to the web hosting technical support:

I am developing a PHP application that depends on Iterators from the Standard PHP Library (SPL)

Some components seem to be missing such as the IteratorIterator class. You may test this:

var_dump(class_exists('IteratorIterator', false)); // gives false

Is there are solution to this?


Oct 12, 2009 at 8:16 AM

I have the same problem, spl is active but class iteratorIterator does not exist:

SPL support enabled
Interfaces RecursiveIterator, SeekableIterator
Classes ArrayObject, ArrayIterator, CachingIterator, CachingRecursiveIterator, DirectoryIterator, FilterIterator, LimitIterator, ParentIterator, RecursiveDirectoryIterator, RecursiveIteratorIterator, SimpleXMLIterator


How can i install it?

My server is Linux Fedora 4.

Thank you

Oct 13, 2009 at 2:10 AM

@teuzzo: It could be you are using an old version of PHP 5? At least PHP 5.2.x may be required.