如何在ddev中设置php memory_limit
我正在运行带有DDEV配置的本地Shopware6环境内幕码头。
尝试通过https://sw6.ddev.site/api/search/product
我获得以下错误:
错误:允许的内存大小:1073741824 bytes bytes用尽了, 之后(尝试分配88686592字节)
,它指向我: “ file”:“/var/www/html/vendor/symfony/http-foundation/response.php”,“ line”:381
哪个内容是:
/**
* Sends content for the current web response.
*
* @return $this
*/
public function sendContent()
{
echo $this->content;
return $this;
}
我从我们的登台服务器中知道如何调整内存限制并解决了问题,但是在我的本地环境中,我设置了memory_limit = 1024m
。将我的容器插入并执行<?php phpinfo(); ?>
输出就像memory_limit => -1 => -1
现在有可能: 由于无上限的内存限制,服务器无法(idk为什么)继续我的请求
任何ddev,.env或.htaccess
配置正在覆盖我修改的php.ini文件。
通往我编辑的php.ini文件的路径: /var/www/html/config/etc/php7/conf.d/php.ini
php.ini的内容:
[Date]
date.timezone="UTC"
memory_limit = 1024M
upload_max_filesize = 6M
max_execution_time = 30
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我忍不住您的应用程序正在吃太多的记忆力,而DDEV设置的默认1GB远远超过了大多数生产站点所允许的范围。但是,如果要更改1GB限制,则将使用
.ddev/php/php/&lt; name&gt; .ini
中的配置文件执行此操作。 /代码>并向它添加一个INI文件。参见:
但是您需要弄清楚为什么您的应用程序使用这么多内存来真正解决您的问题。
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
, create the directory.ddev/php
and add an ini file to it. See https://ddev.readthedocs.io/en/stable/users/extend/customization-extendibility/#custom-php-configuration-phpiniFor example, create a
.ddev/php/memlimit.ini
with the contents:But you'll need to figure out why your app is using so much memory to actually solve your problem.