Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [SF2][SF][Symfony2] Cache dev/ i prod/, Na środ. PROD tworzy się cache dev/ i prod/
damianooo
post 28.01.2018, 10:12:56
Post #1





Grupa: Zarejestrowani
Postów: 493
Pomógł: 2
Dołączył: 15.07.2011
Skąd: Katowice

Ostrzeżenie: (0%)
-----


Na środowisku produkcyjnym w katalogu app/cache tworzą mi się dwa katalogi: dev/ i prod/ . Czy to normalne ?

Po zmianie na produkcji czyszczę cache ale za każdym razem jak tam wchodzę aby go wyczyścić to widzę utworzone oba katalogi dev/ i prod/ .
Gdzie szukać problemu ?

Czy w poniższej konfiguracji nie mam nic namieszane ? Do jakiego pliku powinenem jeszcze zajrzeć ?

app.php :

  1. use Symfony\Component\HttpFoundation\Request;
  2.  
  3. /** @var \Composer\Autoload\ClassLoader $loader */
  4. $loader = require __DIR__.'/../app/autoload.php';
  5. include_once __DIR__.'/../app/bootstrap.php.cache';
  6.  
  7. $kernel = new AppKernel('prod', false);
  8. $kernel->loadClassCache();
  9. //$kernel = new AppCache($kernel);
  10.  
  11. // When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
  12. //Request::enableHttpMethodParameterOverride();
  13. $request = Request::createFromGlobals();
  14. $response = $kernel->handle($request);
  15. $response->send();
  16. $kernel->terminate($request, $response);


AppKernel.php :

  1. use Symfony\Component\HttpKernel\Kernel;
  2. use Symfony\Component\Config\Loader\LoaderInterface;
  3.  
  4. class AppKernel extends Kernel
  5. {
  6. public function registerBundles()
  7. {
  8. $bundles = array(
  9. new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
  10. new Symfony\Bundle\SecurityBundle\SecurityBundle(),
  11. new Symfony\Bundle\TwigBundle\TwigBundle(),
  12. new Symfony\Bundle\MonologBundle\MonologBundle(),
  13. new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
  14. new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
  15. new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
  16. new AppBundle\AppBundle(),
  17. new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
  18. );
  19.  
  20. if (in_array($this->getEnvironment(), array('dev', 'test'), true)) {
  21. $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
  22. $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
  23. $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
  24. $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
  25. $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
  26. }
  27.  
  28. return $bundles;
  29. }
  30.  
  31. public function registerContainerConfiguration(LoaderInterface $loader)
  32. {
  33. $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
  34. }
  35. }
  36.  


Go to the top of the page
+Quote Post
Pyton_000
post 28.01.2018, 11:14:22
Post #2





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

Ostrzeżenie: (0%)
-----


Podstawowe pytanie czy na prod ustawiłes Env SYMFONY_ENV=prod

No i jeśli odpalasz coś z CLI to też musisz ustawić tego env:

SYMFONY_ENV=prod app/console cache:clear

Ten post edytował Pyton_000 28.01.2018, 11:14:53
Go to the top of the page
+Quote Post
damianooo
post 28.01.2018, 11:20:30
Post #3





Grupa: Zarejestrowani
Postów: 493
Pomógł: 2
Dołączył: 15.07.2011
Skąd: Katowice

Ostrzeżenie: (0%)
-----


w którym miejscu to ustawienie się zmienia ?

Go to the top of the page
+Quote Post
Pyton_000
post 28.01.2018, 11:25:02
Post #4





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

Ostrzeżenie: (0%)
-----


najwygodniej w vhost, albo w Environment serwera.
Go to the top of the page
+Quote Post
damianooo
post 28.01.2018, 18:30:10
Post #5





Grupa: Zarejestrowani
Postów: 493
Pomógł: 2
Dołączył: 15.07.2011
Skąd: Katowice

Ostrzeżenie: (0%)
-----


to chyba muszę poprosić hosting aby mi to ustawili smile.gif




hehe, dostałęm informację z hostingu następującą:

Cytat
Nie mamy możliwości dodania takiego parametru na hostingu współdzielonym, jednak podsyłam poniżej temat w którym być może znajdzie Pan rozwiązanie swojego problemu:
https://stackoverflow.com/questions/7114933...console-command

ehh

Ten post edytował damianooo 28.01.2018, 18:30:00
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 16.04.2024 - 17:36