Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Spiral's avatar

Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes)

I have changed memory_limit = 128M to memory_limit = 1G but getting same error

How can fix this plz give me the solution

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Solver.php on line 223

E:\wamp64\www>php -r "echo ini_get('memory_limit').PHP_EOL;"
1G
0 likes
21 replies
JeffreyWay's avatar
Level 59

Hmm, did you restart PHP?

Do you still have an issue if you change memory_limit to -1?

memory_limit = -1

Also, you might try running php --ini and checking if there's an additional parsed .ini file. Something like php-memory-limits.ini.

12 likes
Snapey's avatar

I seem to be getting it a lot lately

I run this

php -d memory_limit=-1 /usr/local/bin/composer require league/flysystem-aws-s3-v3

use your own composer command instead of league/flysystem

13 likes
Tray2's avatar

Make sure that it is the cli php.ini you made the changes to and not the cgi php.ini used by your server.

3 likes
Guppy's avatar

It would be nice if you would also say how you solved your problem.

1 like
Uvaise's avatar

if you are using xaamp for laravel here is your solution Bro.

Go to C:\xampp\php; directory and a file with php.ini it will be a configraution settings file; Open it with your code editor and search for "memory_limit". My _memory_limit was set upto 512M, I changed it to "-1". and my problem was solved.

May be I hope it will help someone.

5 likes
DanielRønfeldt's avatar

Me, yesterday: "Weird error, prolly easy to fix though". Me, 20-ish hours later: "Aaargh! Nothing works!!!" Me, 5 minutes ago: "@snapey sir, you are a GOD!"

1 like
JHTNA's avatar

@uvaise that worked for me on my local xampp environment, thanks

Guppy's avatar

I deleted my composer.phar file and link. Then made fresh installation of composer and voila it worked out of the box.

sbnc's avatar

Really strange. In fact running composer with memory limit disabled as suggested above solved the issue, on the other hand I've been monitoring PHP meanwhile and memory usage went up around 2GiB while running composer require... I'm using composer for almost 2 years now and never seen such thing...

virgiltu's avatar

For anyone that gets this just make sure you run "composer self-update" than run that command again and it will work.

ideepak's avatar

just run this command for linux

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

Snapey's avatar

update composer, come on, don't be lame...

chiefguru's avatar

Upgrading to composer v2 solved all of these out of memory issues for me.

hackernewbie's avatar

Was having the same issue.

I did the following change in the php.ini file, saved it & restarted apache.

Changed memory_limit=512M to memory_limit=-1

I hope this helps.

wakham11's avatar

If this error shows up in shared hosting this solution might help : COMPOSER_MEMORY_LIMIT=-1 composer require your_package/name_here

1 like

Please or to participate in this conversation.