I\'m currently working on Symfony project (const VERSION =\'2.5.10\') and I am using xampp. PHP version is 5.5.19.
My problem is everytime I run my dev environment I
If the memory limit is only being reached under the Symfony dev environment I would suggest adding the following to web/app_dev.php
ini_set('memory_limit', '-1');
This way you can continue to test the production with a sensible amount of memory. Modifying the whole environment via php.ini could hide an error down the line.
Even late to the party, recently I had problems about Out of Memory
just accessing app.php file with Symfony 3.4. Turns out that when you have SELinux set to enforcing
, even if you set the permissions of var
directory inside your project to 777, it won't be able to write on it. If you follow the steps in the official documentation about how deploy in production, it will return a response code 500 and write in web server's error log only that PHP has exhausted the memory limit.
I'm no expert in SELinux, but the only way I could solve this problem was disabling SELinux, but edition /etc/selinux/config
file setting SELINUX=disabled
and restarting the OS.
Again, there's reason to SELinux exists and proper configuration isn't found easily using Symfony's var
sub-folders and can get hard to solve this problem without thinking of disabling SELinux.
The most eager component in Symfony is a profiler. If you don't need profiler in some particular actions you can disable it via code:
if ($this->container->has('profiler'))
{
$this->container->get('profiler')->disable();
}
You can also set global parameter in config:
framework:
profiler:
collect: false
You either disable symfony profiler (I don't think this is what you want as far as I know) or set limit to unlimited with -1
in your php.ini and restart apache.
memory_limit = -1
This may help :
php -d memory_limit=-1 /usr/local/bin/composer require ggergo/sqlindexhintbundle
I solved the Out of memory error on the Twig debug by installing the XDebug.
Because the Twig uses the PHP var_dump
function internally, install the XDebug is a good idea, because it limits the var_dump()
output of arrays and objects to 3 levels deep, as we can see on the documentation.
Credits to @peezi.