Manolo
Manolo

Reputation: 26390

Error when trying to clear cache with a Symfony2 project

When I try to clear cache:

php app/console cache:clear --env=prod --no-debug

I get this error:

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 4304 bytes) in MyProject/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php on line 132

It happens since my last update. I just added a few changes and I did:

git pull

php app/console assets:install web

php app/console assetic:dump --env=prod --no-debug

and then tried to clear cache.

What could I do to solve this?

Upvotes: 3

Views: 6279

Answers (1)

Nicolai Fröhlich
Nicolai Fröhlich

Reputation: 52493

You should try to increase your memory limit in the php.ini that is used for your CLI ( command line interface ).

Looks like PHP is eating more than the allowed 128M during the cache:clear process.

The directive is memory_limit - try:

memory_limit = 256M

You can find your php.ini using ...

php -i | grep ini       (*nix)
php -i | findstr ini    (windows cmd)

... if your cli is using the same php.ini as your webapplication - you can aswell create a file with content and access it through your webserver:

<?php
phpinfo();

... or probably the easiest way just click the PHP logo in symfony's web toolbar and look out for for Loaded Configuration File ( only if cli doesn't use a different php.ini ).

Upvotes: 8

Related Questions