3

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.

7
  • 2
    The error suggests that a 128M memory limit is still in place, I'd investigate as to why your setting isn't applied. Commented Sep 14, 2017 at 5:25
  • have you restarted the server using the command "service apache2 restart" or "service nginx restart" ? Commented Sep 14, 2017 at 5: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 Commented Sep 14, 2017 at 5: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. Commented Sep 14, 2017 at 5:26
  • 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. Commented Sep 14, 2017 at 5:31

2 Answers 2

8

In my case helped this

php -d memory_limit=-1 artisan xxxxxxx
Sign up to request clarification or add additional context in comments.

2 Comments

thanks! works fine, but you need to add the suffix M/G to the 1 php -d memory_limit=1G artisan xxxxxxx
Yes, thank you @BredeBS Fixed. Add memory_limit=-1
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

1 Comment

I used that command but it didn't change my memory limit. php 7.3.18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.