Damaged Organic
Damaged Organic

Reputation: 8467

Symfony 2 on shared hosting - Allowed memory size exhausted

I have this desperate situation.

I need to start a Symfony2 application on shared hosting without SSH access. Symfony uses a lot more memory at first start than on subsequent ones due to cache warmup. Now, I cannot run cache:clear via console, and when I manually try to load page, it produces an error:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /home/domain/domain.com/app/bootstrap.php.cache on line 2681

I cannot increase memory limit, and when I try to upload generated cache from local machine, on page load it gives me complete bollocks:

Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/home/domain/domain.com/app\logs/prod.log" could not be opened: failed to open stream: No such file or directory' in /home/domain/domain.com/app/cache/prod/classes.php:5705

Does anybody know any way to make less hungry for memory or at least to feed it with prod cache that's already made?

Upvotes: 12

Views: 1869

Answers (1)

Guillaume Manen
Guillaume Manen

Reputation: 11

You cannot generate the cache files any other place than in the application itself.

What you can try is to delete the cache manually via rm -Rf app/cache/* or similar, and try and have the application regenerate the cache on the first page load. It will probably result in the same error though.

Why can't you run the cache:clear command ? Usually, memory limit is set higher in cli environment so you would have better luck there.

Upvotes: 1

Related Questions