问题
I'm running Symfony 3.4 LTS with composer. My website works fine, but when I try to update any bundle with :
php composer.phar update
# or
php composer.phar update symfony/symfony
# or
php composer.phar update swiftmailer/swiftmailer
I get this error :
PHP Fatal error: Out of memory [...] in phar:/// [...]
Below is what I have already tested :
- increase my
memory_limit
from196M
to1024M
- run the composer.phar with
php -d memory_limit = -1
.. with no success. What else could I try ?
By the way, if I run free -m
:
total used free shared buffers cached
Mem: 2002 361 1641 0 7 82
-/+ buffers/cache: 270 1732
Swap: 255 255 0
回答1:
use symfony/flex, it embeds optimzations that should reduce the memory requirements of Composer a lot
回答2:
I solved my issue.
- Backup website files in local
- Install Wamp and run the servers
- Increase memory limit to 2G
- Make the
composer update
- Upload the files to the production server
I'm very confusing about composer and its requirements. It's crazy...
回答3:
php -d memory_limit=-1 `which composer` update
回答4:
Update composer to latest version with this command,
composer selfupdate
and then run require command
as mentioned in this asnwer, https://github.com/composer/composer/issues/2704#issuecomment-56169024,
this worked for me.
回答5:
had the same issue on my live server.
rm -R vendor/
composer install
works fine, when composer.json is up to date.
来源:https://stackoverflow.com/questions/51265113/composer-symfony-fatal-error-out-of-memory