首页 > 解决方案 > 如何最大化内存以在 Laravel 中由工厂生成大量数据?

问题描述

我在 Windows 10 的本地环境中使用 XAMP v3.2.4 和 PHP 7.4。

在 Laravel 中,我想通过工厂数据生成器在 MySQL MariaDB 数据库中生成 100 万条记录,但出现内存错误。我怎样才能使内存更大?

PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 69632 bytes) in C:\xampp\htdocs\hasht\vendor\fzaninotto\faker\src\Faker\Provider\Base.php on line
195
PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 32768 bytes) in C:\xampp\htdocs\hasht\vendor\laravel\framework\src\Illuminate\Support\Manager.php
on line 1

标签: laravel

解决方案


推荐阅读