Click here to Skip to main content
15,063,339 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I got a php script running every 1 hour on my server (a thread). What this thread is doing is, the user can upload excel files with data, the thread compares the data in the excel file with that in the database and does something (not relevant some inserts in the database if the found rows dont exist). To read the excel file i call the :

$data = new Spreadsheet_Excel_Reader();

the user can upload more xls files, on the server called: File_1.xls, File_2.xls ,File_3.xls i read the first file get all the data do all the compares do all the inserts this can take a while sometimes its over 6000 rows in excel. I noticed that if the thread runs to long, for example he can insert file 1 and file 2 and file to is a big one like 6000+ rows i get an Abort in my error log. I think it is the excel readers fault. Any ideas?

it seems i used unset() on a private array variable, and that caused the abort in my thread. Interesting that no error messages were send, except that Aborted..
As my opinion, Reading and parsing excel must load whole excel into memory and take much memory to parse excel, so please take care of the memory usage, it might be a killer of your application, you know as default setting in php.ini, there are just few memory can be used, try to add this code at top of the code snippet and see how does it go:

ini_set('memory_limit', '10240M');#Memory usage, assume you have enough memory to use.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900