PHPExcel with many records does not work, what can it be?

0

When wanting to export a table with PHPExcel, everything works fine when there are few records, but when there are more than 3000 records, it does not download the excel file, it remains blank, does the same thing happen to it?

    
asked by Jhoel Subelza 21.07.2016 в 23:09
source

2 answers

1

The problem can not be the number of records. Make sure you have debug enabled first, your page may go blank because you have not enabled "Show Errors"

Place the following two lines at the beginning of your PHP file:

error_reporting(E_ALL);
ini_set('display_errors', '1');

Execute the code again and if it gives you an error message, post it in the information of the question.

On the other hand what I can think of without seeing the code is that the file could not be generated completely because the server reaches the maximum execution time of PHP or that PHP can not use enough memory to execute your script.

To test this in your local environment modify the php.ini and touch the following options:

First increase the execution time by increasing the value of the option:

max_execution_time

And then increase the value of the option:

memory_limit

After modifying the options, restart Apache or the Web server you use and try to execute your code.

    
answered by 23.07.2016 в 18:18
0

If you are downloading an .xls file directly you must have the Content-Length header, ex:

header('Content-Length: '.$length);

where $ length contains the length of the file.

    
answered by 24.10.2016 в 18:31