0
votes

When I started to use Sylius I did not realize that it is not stable yet and I fully customized the dev version instead of starting a new project. Now, I think that I can't put it in prod because of cache management :

  • Images do not always load but sometimes :

    Resource interpreted as Image but transferred with MIME type text/html

  • Same for CSS and JS :

    net::ERR_CONNECTION_RESET

And I can't clear the cache with php app/console cache:clear -e prod :

Clearing the cache for the prod environment with debug true
PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 98304 bytes) in C:\wamp\www\sylius\app\cache\pro_\twig\9a\2e\9cb2d88c764cb674efaa179d7259f64ff3b6396785924a758ca5728914b5.php on line 98

PHP Stack trace:
PHP   1. {main}() C:\wamp\www\sylius\app\console:0
PHP   2. Symfony\Component\Console\Application->run() C:\wamp\www\sylius\app\console:28
PHP   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:121
PHP   4. Symfony\Component\Console\Application->doRun() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:96
PHP   5. Symfony\Component\Console\Application->doRunCommand() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:191
PHP   6. Symfony\Component\Console\Command\Command->run() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:905
PHP   7. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:244
PHP   8. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:83
PHP   9. Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:120
PHP  10. Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer->warmUp() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate.php:47
PHP  11. Twig_Environment->loadTemplate() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer.php:62

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 98304 bytes) in C:\wamp\www\sylius\app\cache\pro_\twig\9a\2e\9cb2d88c764cb674efaa179d7259f64ff3b6396785924a758ca5728914b5.php on line 98

Call Stack:
    0.0005     331032   1. {main}() C:\wamp\www\sylius\app\console:0
    0.0698    3608112   2. Symfony\Component\Console\Application->run() C:\wamp\www\sylius\app\console:28
    0.0764    3860448   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:121
    0.6014   15730344   4. Symfony\Component\Console\Application->doRun() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:96
    0.6027   15730344   5. Symfony\Component\Console\Application->doRunCommand() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:191
    0.6034   15755448   6. Symfony\Component\Console\Command\Command->run() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:905
    0.6037   15755792   7. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:244
    0.7519   16165176   8. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:83
    7.0263   57502064   9. Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:120
   14.6093   95010368  10. Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer->warmUp() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate.php:47
   21.6284  133900880  11. Twig_Environment->loadTemplate() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer.php:62

EDIT : I already cleared the cache manually but it didn't change anything.

1
You could try running $ rm -rf app/cache/* to see if that helpsAdam Elsodaney
depends what you're using to run the commands. Cygwin or Git Bash will execute that rm command. You could also just delete all the files in the app/cache directory with the Windows ExplorerAdam Elsodaney
Sorry, I forgot to add that I already tried to clear it manually.user3406601
Do you even read the error messages? they are really clear, php is configured with too little memory_limitEmii Khaos

1 Answers

0
votes

try this: "#!/user/local/bin/php app/console cache:clear --env=prod"

the answer is based on symfony documention:

https://symfony.com/doc/2.8/console/usage.html