Category: Debugging

Q: Fatal error: allow memory size exhausted when uploading csv file

Cakephp shows a fatal error about "allow memory size of 268435456 bytes exhausted" when trying to upload a CSV file. The CSV file size is quite big about 100mb per file. My Cakephp application is hosted on Ubuntu 14.04, Digital Ocean.

I have changed the memory_limit in php.ini (googled), but I still get the error. Could someone help me?

SOLVED memory csv digitalocean limit
1 Answers
Accepted by AJhamper

AJhamper:

I think you may overcome this problem by adding:

//in controller
public function yourfunction() {

  set_time_limit(0); // to overwrite time execution limit
  ini_set('memory_limit','1024M'); // to overwrite php's default memory limit
}

to your function (so the overwrite rule will only apply to this function), and there is no need to change server's configuration.

Kristi
Kristi

137

Created: 11 Sep '16

Last Reply: 13 Sep '16

Replies: 1

Views: 535

Votes: 1

Welcome to Aero Coding!

Aero Coding is a CakePHP-focused Q&A community for professional and enthusiast cake bakers. It's built and run by you as part of the community.


Join Now Tour

Download Cakephp

Start baking your own CakePHP application!


Cakephp All Versions