gpt4 book ai didi

php - Symfony 3 Doctrine PHP fatal error : Allowed memory size of X bytes exhausted (tried to allocate Y bytes)

转载 作者:行者123 更新时间:2023-12-05 07:49:10 25 4
gpt4 key购买 nike

尝试使用命令生成数据库时:

php bin/console doctrine:schema:update --force

我遇到了这些错误:

PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in ...\vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php on line 281

Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in ...\vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php on line 281

PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0

Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0

我已经在 php.ini 中尝试了所有可能的 memory_limit 设置,但没有任何帮助。

与:

php bin/console doctrine:schema:update --dump-sql

错误是:

PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in ...\vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php on line 281

Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in ...\vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php on line 281

PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0

Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0

最佳答案

在我的例子中,这个错误是由一个非常具体的错误引起的:

我的用户映射设置了自定义存储库类。所述存储库具有如下构造函数,这导致了无限循环:

public function __construct(private EntityManagerInterface $manager)
{
$this->repository = $manager->getRepository(User::class);
}

因为我真的不需要自定义存储库,所以只需将其从映射中删除即可。

关于php - Symfony 3 Doctrine PHP fatal error : Allowed memory size of X bytes exhausted (tried to allocate Y bytes),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37765103/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com