1

It seems that only on the production server warming up the cache causes an error. This is how I try to warm up the cache:

$ rm -rf app/cache/*
$ chmod -R 777 app/cache/
$ php app/console doctrine:cache:clear-metadata --env=prod
$ php -r "apcu_clear_cache();"
$ php app/console cache:warmup --env=prod --verbose

On my local dev environment this works like a charm. I'm using Symfony 2.8.22 and PHP 7.0. The error is on my production server is:

[Symfony\Component\Debug\Exception\FatalErrorException]                                           
Compile Error: require(): Failed opening required '/home/wingman/Symfony/app/cache/pro_/doctrine  
/orm/Proxies/__CG__CmsCoreBundleEntityPagePageGroup.php'  
(include_path='.:/opt/alt/php70/usr/share/pear')                                                                                   

Exception trace:
/home/wingman/Symfony/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php:209

I have already stripped down the entity, that the error is about, to a minimum:

/**
 * @ORM\Table(name="cms_cr_page_group")
 * @ORM\Entity(repositoryClass="Cms\CoreBundle\Entity\Page\PageGroupRepository")
*/
class PageGroup {

  /**
   * @ORM\Id
   * @ORM\Column(type="integer", options={"unsigned":true})
   * @ORM\GeneratedValue(strategy="AUTO")
   */
  private $id;
BigJ
  • 1,990
  • 2
  • 29
  • 47
  • any reason why app/console cache:clear isn't enough for you? – Pinoniq Jun 12 '17 at 16:28
  • The cache warm up is just a part of the "cache:clear", so it gives the same error, but in my question it is more clear that the cache warm up is the error. – BigJ Jun 13 '17 at 19:43

1 Answers1

1

APCU cache isn't accessible from command line, you need web context to be able to clear it.

Personally I use a tool called cachetool.phar in my project to clear ACPU cache (actually it offers more).

So to clear you APCU cache :

php cachetool.phar apcu:cache:clear --fcgi=127.0.0.1:9000 (adapt PHP-FPM/PHP-CGI port)

Try also clearing query php app/console doctrine:cache:clear-query cache if the problem persists.

Takman
  • 1,028
  • 10
  • 13