12

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?

8
  • 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 host Commented Jun 28, 2015 at 14:32
  • @RiggsFolly - it's 64 mb, not 64 kb. (edit: as you recognized yourself. ;) ) Commented Jun 28, 2015 at 14:34
  • @RiggsFolly: Yes, max memory limit is ~ 64Mb, and I cannot increase it. But I absolutely need to get this website running on that host. Commented Jun 28, 2015 at 14:35
  • @x-ray You I kinda thought i had slipped a bit Commented Jun 28, 2015 at 14:47
  • 1
    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. Commented Jun 28, 2015 at 18:39

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Deleting cache manually is the obvious solution, but application breaks on first load with error message described in question. The question itself is actually about "how to warmup cache in shared hosting environment with available memory under requirements", which also means - no CLI.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.