0

I got this error when saving with a file on input. The file is uploaded but I got this in saving process.

Allowed memory size of 134217728 bytes exhausted (tried to allocate 94 bytes) in ...vendor/laravelbook/ardent/src/LaravelBook/Ardent/Ardent.php

The size of the file is just 24kb. And the code is just a typical eloquent fill. The process is the following:

Get the file from the input, moved to storage location and make an insert for its file path in the database. Update the file id of the target eloquent model.

I'm using:

"laravelbook/ardent": "v2.4.2"
majidarif
  • 18,694
  • 16
  • 88
  • 133
lukaserat
  • 4,768
  • 1
  • 25
  • 36
  • I had the same error and it appeared that I had an infinite loop in my code - so first check your code carefully ;) – tsveti_iko Sep 29 '16 at 16:17

2 Answers2

0

Your script is eating all of the memory that PHP process can use, in your case it's 128 MB.

You can do 2 things:

  1. Optimize your code and figure out which part of the code is the problem.
  2. Set higher memory_limit with changing php.ini value of memory_limit to 256M for example, or by calling ini_set('memory_limit','256M');
Rabas
  • 573
  • 1
  • 6
  • 13
0

It caused by the "php artisan optimize --force". When I removed the bootstrap/compiled.php it works again. :) Btw, how is that? is it a bug for "php artisan optimize --force" of Laravel?

lukaserat
  • 4,768
  • 1
  • 25
  • 36