unserialize(): Error at offset 176 of 177 bytes in PHPTemp.php

Topics: User Forum
Apr 15, 2011 at 2:20 PM
Edited Apr 16, 2011 at 7:37 AM


Could you please help me with my problem?

I'm trying to export data (set of SQL tables) to Excel and have no problem with 8 or less exported tables, but with 9 or more I have

unserialize(): Error at offset 176 of 177 bytes in PHPTemp.php

As I can see it is not data format problem, it is memory limit or something like this.

Here is screen copy of the apache error file (sorry for screen copy, but it was the only way to get it from Citrix)http://phpexcel.codeplex.com/Project/Download/AttachmentDownload.ashx?ProjectName=phpexcel&WorkItemId=10749&FileAttachmentId=5585

Memory_peak always shows value around 20Mb when I do export for 8 tables. For 9 and more is shows about 15.8Mb.

I tried to play with memoryCasheSize values from 1Mb to 32Mb but with no success.

Do you have any suggestions what should I check and tune?

Thanks in advance!

Apr 16, 2011 at 7:23 AM

After small code update I could export up to 9 tables.

Updates in my code include checks on empty data.

This gave me a bit more memory but does not fix my problem.

Apr 22, 2011 at 3:26 PM

Way forward is stop using

$cacheMethod = PHPExcel_CachedObjectStorageFactory:: cache_to_phpTemp;
$cacheSettings = array( ' memoryCacheSize '  => '8MB' );
PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);

and increase memory_limit for PHP.

But it is not solution. It is workaround

Aug 28, 2012 at 2:11 PM
Edited Aug 28, 2012 at 2:12 PM


Running into a similar issue. mzeddd mentioned using the memory limit in PHP -- is there a code example of how I'd bypass using PHP Excel. We are running a Linux VPS, 2GB of RAM, FCGI with APC and increased server settings to rediculous amounts:

max_execution_time = 200000

max_input_time = 200000

memory_limit = 512M

Using a file with about 12,000 lines (2.4MB file), but only when I decrease the amount to 2,000 or so does it go through. Otherwise, I get the following error:

Warning: fread() [function.fread]: Length parameter must be greater than 0 in/home/usr/public_html/libraries/phpexcel/Classes/PHPExcel/CachedObjectStorage/PHPTemp.phpon line 98

Fatal error: Call to a member function attach() on a non-object in/home/usr/public_html/libraries/phpexcel/Classes/PHPExcel/CachedObjectStorage/PHPTemp.phpon line 100

Fatal error: spl_autoload() [<ahref='function.spl-autoload'>function.spl-autoload</a>]:Class JFactory could not be loaded in/home/usr/public_html/libraries/joomla/session/storage/database.php online 84

Any help would be EXTREMELY appreciated as I and my data center are at our whit's end here. Running 1.7.7. Thanks!