Add this line at the top of the script:
Add this line to the server’s PHP.INI file:
memory_limit = 12M
If 12M (12 megabytes) isn’t enough, then keep increasing it until it works or until you can’t anymore..
To increase the amount of memory available inside a WordPress installation, edit the wp-settings.php file and update this line: define(‘WP_MEMORY_LIMIT’, ’32M’);
Change that value to 64M or more as needed. FYI…you might have to contact your host if they do not allow you to adjust this value.