Reputation: 4097
I recently got a job in a web newspaper. In the website, we have a very old and important Symfony Application, written for an older developer, long time gone. That application is sacred: is the blood of the newspapers revenues. The problem is we have no backup, no developer installation, nothing, only the production installation When I came here, I was very surprise for this risky decision. I week ago, the apps started to fail. I have zero experience in Symfony (i'm a rails developer), and that old apps was the "old and loyal dog who nothing will fail", but started to fail, and everyone is freaking out!
So, I need the help of the symfony developers of this site to find a "quick" solution meanwhile I try to convince my bosses that we need a more professional aproach (and the times and resources to do it) The problem is this
Every time the people use the app, this message appear
fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 17106016 bytes) in /path/to/symfony/config_core_compile.yml.php on line 3366
The lines is in the middle of this function
public function shutdown()
{
if (!is_null($this->cache) && $this->cacheChanged)
{
$this->cacheChanged = false;
$this->cache->set('symfony.routing.data', serialize($this->cacheData));
}
}
I looked at google but only found people with the same problem, no solution... Please, anyone who could help me, Help me please!
Upvotes: 3
Views: 809
Reputation: 3172
I would try to first clear the cache in the app as the cache may just be massive.
in the symfony root folder run this command
php symfony clear:cache
If that does not solve the problem, I would up the memory limit until the root of the problem is fixed
So inside the index.php file add this before any symfony loading occurs
ini_set('memory_limit', '256M');
The best way to debug the app is to use the built-in dev environment. Add a file to the symfony web root that has the following:
// this check prevents access to debug front controllers that are deployed by accident to production servers.
// feel free to remove this, extend it or make something more sophisticated.
if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1', 'YOUR IP ADDRESS HERE')))
{
die('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.<!-- ' . $_SERVER['REMOTE_ADDR'] . ' -->');
}
require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
$configuration = ProjectConfiguration::getApplicationConfiguration('[app name]', 'dev', true);
sfContext::createInstance($configuration)->dispatch();
Don't forget to add your IP address in the third line so that you have access to view the dev environment data.
The app name is the name of the application that is in your %symfony root%/apps
folder
Upvotes: 1
Reputation: 336
And maybe it's working on debug mode. Check in the front controller /index.php the line $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', true); It should be $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false);
Upvotes: 0
Reputation: 1484
I think the problems is the size of the cache of PHP, not symfony. The fastest way to overcome this issue is giving more memory to php. For your description you have 128MB of memory size, try giving 256 (for example). If you're on linux check this to change de memory size.
Know this is a patch, not a base solution.
Upvotes: 1