shopware 6 购物车 API 内存不足

发布于 2025-01-13 18:27:05 字数 734 浏览 1 评论 0原文

我构建了一个配置产品包的应用程序,最后一个操作是将产品添加到购物车。我对 /store-api/context 进行 API 调用,然后将令牌设置为 sw-context-key 以使用正文再次调用 /store-api/checkout/cart/line-item:

{
"items": [
    {
        "id":"5a48801fa3164919b44bfc95bc5cf6831",
        "referenceId":"5a48801fa3164919b44bfc95bc5cf6831",
        "quantity":2,
        "type":"product"
    },
    {
        "id":"ed6149fc89834a7ebadde07c18509a4a1",
        "referenceId":"ed6149fc89834a7ebadde07c18509a4a1",
        "quantity":1,
        "type":"product"
    }
]

}

不幸的是,来自服务器始终出现内部服务器错误,并显示“错误:允许的内存大小 4294967296 字节已耗尽”。 令我惊讶的是,根据phpinfo();,内存限制被设置为4096M。

数据库产品表包含219000条条目。即使我将内存限制设置为32768M也不起作用,这很奇怪。也许有人已经找到了一个解决方案,可以给我一个提示,我必须如何正确配置 php,以便 api 可以正常工作。

I have built an app that configures product bundles, the last action is to add the products to the cart. I make an API call to /store-api/context and then set the token as sw-context-key to make another call to /store-api/checkout/cart/line-item with the body:

{
"items": [
    {
        "id":"5a48801fa3164919b44bfc95bc5cf6831",
        "referenceId":"5a48801fa3164919b44bfc95bc5cf6831",
        "quantity":2,
        "type":"product"
    },
    {
        "id":"ed6149fc89834a7ebadde07c18509a4a1",
        "referenceId":"ed6149fc89834a7ebadde07c18509a4a1",
        "quantity":1,
        "type":"product"
    }
]

}

Unfortunately the response from the server is always an internsal server error with "Error: Allowed memory size of 4294967296 bytes exhausted".
What surprises me is that the memory_limit is set to 4096M according to phpinfo();.

The database product table includes 219000 entries. Even if I set the memory_limit to 32768M it does not work, that is very strange. Maybe someone has found a solution for this of can give me a hint how I have to configure php right, so the api can work correctly.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文