My *nix world

Symfony Compile Error Failed opening required Proxies

While testing a Symfony web application in production environment (--env=prod) I encountered an odd exception which more or less was triggered with each request:

Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalErrorException:

Compile Error: require(): Failed opening required 'var/cache/prod/doctrine/orm/Proxies/__CG__some-file.php' (include_path='.:/usr/share/php7:/usr/share/php') at vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php line 223

First I should clarify few things:

  • my Symfony v3.4.4 application defines few Doctrine ORM entities which are configured to use the ORM Cache via @ORM\Cache annotation
  • the application configuration (see config.yml) defines the options doctrine.orm.entity_managers.{metadata_cache_driver,query_cache_driver,result_cache_driver,second_level_cache}

In order to fix this the first thing I tried was to clear the cache for the production environment:

bin/console cache:clear --env=prod

but unfortunately this didn't fix the problem.

The I removed the var/cache/prod folder manually and I just let the application to recreate the cache by itself. It also dind't work.

The only thing that seemed to work was to warm-up the cache forcibly by running the following command:

bin/console cache:clear --env=prod --no-debug

bin/console cache:warmup --env=prod --no-debug

Please note that this problem never occurred in development environment.

Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.

The following two tabs change content below.
Symfony Compile Error Failed opening required Proxies

Eugen Mihailescu

Founder/programmer/one-man-show at Cubique Software
Always looking to learn more about *nix world, about the fundamental concepts of math, physics, electronics. I am also passionate about programming, database and systems administration. 16+ yrs experience in software development, designing enterprise systems, IT support and troubleshooting.
Symfony Compile Error Failed opening required Proxies

Latest posts by Eugen Mihailescu (see all)

2 thoughts on “Symfony Compile Error Failed opening required Proxies

  1. Bastien Ho

    Hi, thank you for this tip!

    anyway, just a mistake in your code :

    bin/console cache:warmup --env-prod --no-debug
    should be:

    bin/console cache:warmup --env=prod --no-debug

Leave a Reply

Your email address will not be published. Required fields are marked *