1

It's confusing, why this error shown. I'm using Laravel 5.4, after using composer update then this error shown.

$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 495616 bytes) in E:\xampp\htdocs\botble\vendor\symfony\debug\ExceptionHandler.php on line 238
PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) in E:\xampp\htdocs\botble\vendor\symfony\debug\Exception\FlattenException.php on line 203
Script php artisan optimize handling the post-update-cmd event returned with error code 255

As some of answer on stack and other community, i'm also test this after update php.ini with memory_limit 2048M. But still same error shown.

Any suggestion for this issue.

CodeBriefly
  • 1,000
  • 4
  • 16
  • 29
  • 2
    The error suggests that a 128M memory limit is still in place, I'd investigate as to why your setting isn't applied. – flauntster Sep 14 '17 at 05:25
  • have you restarted the server using the command "service apache2 restart" or "service nginx restart" ? – Adarsh Sojitra Sep 14 '17 at 05:25
  • 2
    I would not globally increase the memory limit, it is there to prevent rogue or buggy scripts from causing a DoS. Instead increase it just for your one use case, ie: `php -d memory_limit=2048M /path/to/composer update` – Geoffrey Sep 14 '17 at 05:26
  • 1
    @AdarshSojitra That has nothing to do with it, this is being executed on the CLI which is outside the scope of Apache. And futhermore, Nginx doesn't have a PHP module to reload, it uses a CGI handler (ie, FPM), restarting Nginx has no impact on PHP at all ever. – Geoffrey Sep 14 '17 at 05:26
  • Is this vanilla Laravel or you have required other packages? Sharing your `composer.json` might help. – josephting Sep 14 '17 at 05:30
  • 1
    @josephting This has nothing to do with the issue, it is clear that the memory_limit is still fixed at 128M after the attempt to raise the limit. – Geoffrey Sep 14 '17 at 05:31
  • Just found this thread related to your issue. https://stackoverflow.com/questions/34864524/allowed-memory-size-of-536870912-bytes-exhausted-in-laravel/34864884 – nairsumesh1991 Sep 14 '17 at 09:07

2 Answers2

3

This is memory limit issue . You can try something like this

Fist find composer directory using bellow command

$>which composer
/usr/local/bin/composer

After you can update composer with memory limit

$>php -d memory_limit=-1 /usr/local/bin/composer update

-1 means unlimited memory

Yashvantsinh Zala
  • 531
  • 1
  • 3
  • 11
1

In my case helped this

php -d memory_limit=-1 artisan xxxxxxx
Ruslan Novikov
  • 1,320
  • 15
  • 21