php - Symfony 5 缓存 :clear php. 关键: fatal error :允许的内存大小

标签 php symfony symfony4 symfony5

我在尝试使用 Symfony 5 时遇到以下错误

bin/console cache:clear

我知道如何修补 (memory_limit=-1) 但我想知道为什么我会出现这个错误。

错误 :

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32230840 bytes) in /Applications/MAMP/htdocs/Toile./vendor/twig/twig/src/Lexer.php on line 157

15:50:13 CRITICAL [php] Fatal Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32230840 bytes)

[
  "exception" => Symfony\Component\ErrorHandler\Error\OutOfMemoryError {
    -error: [
      "type" => 1,
      "message" => "Allowed memory size of 134217728 bytes exhausted (tried to allocate 32230840 bytes)",
      "file" => "/Applications/MAMP/htdocs/Toile./vendor/twig/twig/src/Lexer.php",
      "line" => 157
    ]
    #message: "Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32230840 bytes)"
    #code: 0
    #file: "./vendor/twig/twig/src/Lexer.php"
    #line: 157
  }
]

In Lexer.php line 157: Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32230840 bytes)



我无法跟踪此错误的来源。

我从我的项目中删除了所有的 Twig 模板,我手动清除了缓存,但什么都没有......知道吗?

谢谢

最佳答案

它看起来像 bin/console cache:clear命令占用大量内存。我不认为这是因为 Twig 文件。

设置 memory_limit=-1有点像您禁用内存限制,这意味着提供无限的内存来运行 PHP。请检查您的 php.ini 文件并调整 memory_limit。

请注意,您可能有 2 个用于 PHP 的 php.ini 文件,一个用于 Web,一个用于命令行。使用 php -i查看加载的ini文件。

使用此命令 php -i | grep 'Configuration'从命令行 grep 输出。

关于php - Symfony 5 缓存 :clear php. 关键: fatal error :允许的内存大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59615605/

相关文章:

javascript - [对象 HTMLTablerowElement]

javascript - Symfony 4 表单与 ckeditor 文本区域未提交

php - Symfony 4 Custom Bundle 使用 Logger Interface

php - 在1个查询mysql中插入多行

php - TestLink 1.9.14 安装

php - mysql_connect 不适用于 php?

javascript - 如果之前的进程正常工作,Symfony 不会发送响应

symfony - Symfony2 Doctrine 无法识别的字段:

image - 带有 liipImagineBundle 的动态过滤器

php - 如何在 Symfony 4 中找到 app/AppKernel.php?