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.
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)
The error isn't in this line. I had the same error when i had imported data from an excel file and logged some "models" data with print_r or var_dump where the whole "model" is added to the log (including relations traversing etc.)
You can fix this by limiting the depth of the dump by using the Vardumper instead of print_r or var_dump and setting a depth (e.g. 3)
yii\helpers\VarDumper::dumpAsString($var, $depth, $highlight)
Then only the code is returned to this depth and the log would getting smaller.
Also if you have many inserts / updates to your database the log will get pretty long.
The problem btw comes from the debug toolbar. You wouldn't get the error if the debug module is disabled.
but other then increasing the memory there isn't real solution