Yii2 Allowed memory size exhausted

前端 未结 2 1052
长发绾君心
长发绾君心 2021-01-19 12:47

I\'m uploading file to my Yii2 project. The file it self is ~100kB, contains ~45 000 short lines that are processed by controller and added line-by-line to the database.

2条回答
  •  走了就别回头了
    2021-01-19 12:55

    I already had experience of such situations. You can act in two ways

    1) - raising the memory_limit parameter in php.ini

    ; Maximum amount of memory a script may consume (128MB)
    ; http://php.net/memory-limit
    ; memory_limit = 128M
    memory_limit = 256M
    

    2) - by splitting the file you're iterating into smaller parts and manage them with separate scripts (or separate post)

提交回复
热议问题