I am working in CodeIgniter. What I am trying to do is reading an Excel file and saving to a database. To read the Excel file, I am using this library. After uploading, while reading the Excel file, I am getting this error:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /home/webscwi1/public_html/projects/OnlineExam/application/libraries/excel_reader.php on line 430
Anyhow, I can change the memory size from 12Mb to 512Mb, I'm still getting the same error. I don't know what is the exact error and I want to know whether this is a server error or a problem in the code.
Additional info: If I upload the file with 15 rows, it's working fine, but if I upload with 90 rows in Excel I am getting this error:
$this->load->library('excel_reader');
$this->excel_reader->read('question/'.$filename);
$worksheet = $this->excel_reader->worksheets[0];
Thanks to all.
You should increase your Memory limit:
editing your php.ini file
memory_limit = 512M
OR
including this line on the top of your script
ini_set("memory_limit","512M");
You should also check if this lines are on your .htaccess:
php_value memory_limit <value>
php_value upload_max_filesize <value>
Their values override the php configuration. So they should reflect your needs, or simply be removed.
You should add attribute php_value on your file NameOfProject/.htaccess
<IfModule mod_rewrite.c> php_value memory_limit 256M </IfModule>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With