1
Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 145460 bytes) in /home/legalvis/public_html/wolfpack/vendor/composer/ClassLoader.php on line 411

I've got this error when trying to execute a rather large script. I've tried a few things:

  1. Putting ini_set('memory_limit', '3G'); almost everywhere in my code (including ClassLoader.php)
  2. Checking my php.ini file

When I do a php -i or phpinfo(); the allowed size is 3G.

My script is working perfectly locally, but on the server despite the configuration it seems to be failing.

Any idea?

Vico
  • 1,696
  • 1
  • 24
  • 57
  • Possible duplicate of [Allowed memory size of 262144 bytes exhausted (tried to allocate 24576 bytes)](http://stackoverflow.com/questions/16175153/allowed-memory-size-of-262144-bytes-exhausted-tried-to-allocate-24576-bytes) – xkcd149 Mar 03 '16 at 05:27

2 Answers2

2
Try this: ini_set('memory_limit','3072M');
Peeje
  • 445
  • 2
  • 9
  • That's weird. But it's working. Don't know why it was not working at the beginning, and why it's working now. But thanks! – Vico Mar 03 '16 at 05:44
-1

of the problem : (windows 10) (if you work with xampp)

PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 67108872 bytes) in phar://C:/composer/composer.phar/src/Composer/DependencyResolver/RuleSet.php on line 83

you can just run this in cmd :

php -r "echo ini_get('memory_limit').PHP_EOL;"

if you have 512M or 128M you can just go to c/xampp/php and if you see any file php.ini you can just change 512M or nothing in -1 (-1 it's mean 2G) in all files also repeat this command and verify if memory_limit change or not

also you can run :

composer update

happy coding :)