problem with large file

Topics: Developer Forum, Project Management Forum, User Forum
Nov 29, 2010 at 12:29 PM
Edited Nov 29, 2010 at 12:32 PM

I use the following code in order to change the value of only one cell on a very large file (about 4 MB) including 18 worksheets:

 

require_once 'Classes/PHPExcel/IOFactory.php';
$Piano = "file.xls";
$objPHPExcel = PHPExcel_IOFactory::load($Piano);
$objPHPExcel->setActiveSheetIndex(1);
$objWorksheet = $objPHPExcel->getActiveSheet();
$objPHPExcel->getActiveSheet()->setCellValue('B3', 'ABCDE');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace(".xls","_copy.xls",$Piano));

after 1200 seconds I can see the following error: Fatal error: Maximum execution time of 1200 seconds exceeded in Classes\PHPExcel\Calculation.php on line 2927.

How can it be possible? Any suggestion?

 

Nov 29, 2010 at 3:20 PM

This is possible because the php.ini variable max_execution_time is set to 1200 and it probably takes longer than that to process this code.

Coordinator
Nov 29, 2010 at 6:57 PM

If you're working with large files, they do take a long time to read and/or write. The physical size of the file (4MB) isn't a good measure of the workbook size. The number of workbooks, and the number of cells (rows * columns) is more important.

The latest SVN code does speed up writing quite significantly: twice as fast as the 1.7.4 release for Excel5 files. However, even that may not be fast enough for very large workbooks, and the only way to avoid a timeout is to increase the PHP timeout setting.

Mar 5, 2012 at 6:13 AM

So how to increase the PHP timeout setting ?

Coordinator
Mar 5, 2012 at 6:36 AM
set_time_limit(3000);