HP Fatal error: Allowed memory size of XXXX bytes exhausted (tried to allocate XXXX bytes) in vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228
Am getting error like this. I have change the memory limit to -1. Can anybody figure it out why this error is occurring.
Maybe the .htaccess is overriding your config value?
let me know your apache handler
you can post it from phpnfo() function
You might have encountered this error while running the static content deploy or compilation command. In addition, the memory exhausted error occurs while installing a library using a composer.
It is due to the limited memory of your live site or local host. The library you are installing might require more memory limit for a successful installation, which is not available, and therefore the error occurs.
The solution for this error is to directly increase the memory limit using the below command,
Add memory limit in the command:
php -d memory_limit=-1 bin/magento setup:di:compile php -d memory_limit=-1 bin/magento setup:static-content:deploy
Set the memory limit as "-1," which means infinite. The required memory will be occupied by the infinite memory available.
Add memory limit while installing library using composer:
$ which composer
php-d memory_limit=-1 [composer_path] require twilio/sdk
I hope the above solution helps you fix the "Allowed Memory Size of Bytes Exhausted in Magento" error.