This error message is being presented, any suggestions?
Allowed memory size of 33554432 bytes exhausted (tried to allocate 43148176 bytes) in php
The correct way is to edit your php. ini file. Edit memory_limit to your desire value. As from your question, 128M (which is the default limit) has been exceeded, so there is something seriously wrong with your code as it should not take that much.
Try prefixing your command with COMPOSER_MEMORY_LIMIT=-1 . This will remove the memory limit for the execution of the command. Update: Memory exhaust errors should now be resolved by using Composer 2.
Increasing the PHP memory limit The default memory limit is 256M and this is usually more than sufficient for most needs. If you need to raise this limit, you must create a phprc file.
At last I found the answer:
Just add this line before the line where you get error in your php file
ini_set('memory_limit', '-1');
It will take unlimited memory usage of server, it's working fine.
Consider '44M'
instead of '-1'
for safe memory usage.
Here are two simple methods to increase the limit on shared hosting:
If you have access to your PHP.ini file, change the line in PHP.ini If your line shows 32M try 64M: memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)
If you don't have access to PHP.ini try adding this to an .htaccess file: php_value memory_limit 64M
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With