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