I'm getting below error message while exporting csv file of 40k record.

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65552 bytes) in /var/www/html/crf-git/modules/syslog/syslog.module on line 115.

How to catch or handle this kind of error?

Thanks & Regards, Sachin

2 Answers 2


You need to increase your PHP memory limits.

This is the recommended approach if you have access to the server's php.ini. This will not be possible in some shared hosting environments, though your host may be able to adjust it for you. Note that this change will affect all websites and PHP scripts on the server.

Locate the php.ini file used by your web server.

Edit the memory_limit parameter in the php.ini file (usually in a section called Resource Limits). Make sure you use M to specify the number of megabytes (not MB). memory_limit = 256M ; Maximum amount of memory a script may consume (256MB) If there is no section already for this, place the above line at the end of the file.

Restart Apache.

Credit: https://www.drupal.org/docs/7/managing-site-performance-and-scalability/changing-php-memory-limits


For such issues you generally have two possibilities: increase the memory available to the process, or do things in smaller chunks. You could try exporting the data in smaller batches.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.