I am running a local shopware6 environment insider docker with DDEV configuration.
After trying to fetch all products (~11.000) via https://sw6.ddev.site/api/search/product
I get following error:
Error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 88686592 bytes)
And it points me to:
"file": "/var/www/html/vendor/symfony/http-foundation/Response.php", "line": 381
which 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 solve the problem, but in my local environment I set memory_limit = 1024M
. SSHing to my container and executing <?php phpinfo(); ?>
the output is like memory_limit => -1 => -1
Now there are to possibilities: Because of the uncapped memory limit the server can not (idk why) proceed my request
Any DDEV, .env or .htaccess
configuration are overwriting the my modified php.ini file.
Path to my edited php.ini file:
/var/www/html/config/etc/php7/conf.d/php.ini
Content of php.ini:
[Date]
date.timezone="UTC"
memory_limit = 1024M
upload_max_filesize = 6M
max_execution_time = 30
CodePudding user response:
I can't help with the fact that your app is eating too much memory, and the default 1GB that DDEV sets up is far more than most production sites will allow. But if you want to change the 1GB limit, you'll do it with a config file in .ddev/php/<name>.ini
, see https://ddev.readthedocs.io/en/latest/users/extend/customization-extendibility/#providing-custom-php-configuration-phpini
For example your .ddev/php/memlimit.ini
might have the contents:
[PHP]
memory_limit = 2G
But you'll need to figure out why your app is using so much memory to actually solve your problem.