I am running local shopware6 environment insider docker using DDEV configuration.
After trying to get all products (~11.000) via https://sw6.ddev.site/api/search/product
I get the following error:
Error: Allowed memory size 1073741824 bytes exhausted (attempted to allocate 88686592 bytes)
It pointed out to me:
"File": "/var/www/html/vendor/symfony/http-foundation/Response.php", "Line": 381
The content is:
/** * Sends content for the current web response. * * @return $this */ public function sendContent() { echo $this->content; return $this; }
I know from our staging server how to adjust the memory limit and resolve the issue, but in my local environment I set memory_limit = 1024M
. Connecting to my container via SSH and executing the output looks like
memory_limit => -1 => -1
Now there are the following possibilities: The server cannot (not sure why) process my request due to uncapped memory limit
Any DDEV, .env or .htaccess
configuration will overwrite the php.ini file I modified.
The path of the php.ini file I edited:
/var/www/html/config/etc/php7/conf.d/php.ini
php.ini content:
[Date] date.timezone="UTC" memory_limit = 1024M upload_max_filesize = 6M max_execution_time = 30
I'm frustrated by the fact that your app is taking up too much memory, and the default 1GB set by DDEV is far more than most production sites allow. But if you want to change the 1GB limit, you can do it using the configuration files in
.ddev/php/.ini
, create the directory.ddev/php code> and add a ini file. See https://ddev. readthedocs.io/en/latest/users/extend/customization-extendibility/#custom-php-configuration-phpini
For example,
.ddev/php/memlimit.ini
may contain the following:But you need to figure out why your app is using so much memory to really solve your problem.