12
votes

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?

1
Unless I have slipped a bit, that means your max memory allowcation is 64meg. I think either there is an issue with the hosting or you are going to have to move to a real hostRiggsFolly
@RiggsFolly - it's 64 mb, not 64 kb. (edit: as you recognized yourself. ;) )x-ray
@RiggsFolly: Yes, max memory limit is ~ 64Mb, and I cannot increase it. But I absolutely need to get this website running on that host.Damaged Organic
@x-ray You I kinda thought i had slipped a bitRiggsFolly
Right, so there is no answer other than got to a Hosting package that provides more that 64meg of memory to its PHP users. Alternatively set you development site up with similiar restrictions so you dont get surprises like this when you try and go live.RiggsFolly

1 Answers

1
votes

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.