Three ways to solve the “Fatal error: Allowed memory size of XXX bytes exhausted” problem
When your script does not have enough RAM to execute it (or rather, it does not fit into the amount that it is allowed), the error “Allowed memory size of XXX bytes exhausted (tried to allocate YYY bytes)” occurs.
To solve this problem, I propose three options to choose from, depending on the access rights on the server and its configuration.
One of these options will definitely help you. ')
Method one:
In the PHP settings file (php.ini) we write:
memory_limit = 100M
Usually for mere mortals this file is not allowed to edit. It all depends on your hosting provider. Yes, and you have nothing to do there.
Method two:
In the site settings file (.htaccess) we write:
php_value memory_limit 100M
With a certain server configuration, you may get an error 500 - Internal Server Error.
Method three:
In the body of your script (for example, config.php) we write: <?php ini_set('memory_limit', '100M'); ?>
The easiest and safest way to solve a problem. It helps me constantly.