PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 8, 2022

[FIXED] symfony5 - not working after composer udpate (cache issue)

 February 08, 2022     caching, composer-php, doctrine-orm, symfony     No comments   

Issue

My website is down since composer update. The issue seems not on the updated packages themselves (I run them in dev environment without problems, too). It seems that 'only' the cache cannot clean itself correctly.

Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "5.1.*"

Prefetching 9 packages 🎶 💨
  - Downloading (100%)

Package operations: 0 installs, 51 updates, 3 removals
  - Removing symfony/uid (v5.1.8)
  - Removing symfony/polyfill-uuid (v1.20.0)
  - Removing easycorp/easyadmin-bundle (v3.1.9)
  - Updating symfony/flex (v1.10.0 => v1.11.0): Loading from cache
  - Updating symfony/routing (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/http-foundation (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/event-dispatcher (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/var-dumper (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/error-handler (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/http-kernel (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/finder (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/filesystem (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/dependency-injection (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/config (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/var-exporter (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/cache (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/framework-bundle (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/doctrine-bridge (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/string (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/console (v5.1.8 => v5.1.9): Loading from cache
  - Updating doctrine/doctrine-bundle (2.2.1 => 2.2.2): Loading from cache
  - Updating doctrine/inflector (1.4.3 => 2.0.3): Loading from cache
  - Updating doctrine/common (3.0.2 => 3.1.0): Loading from cache
  - Updating doctrine/orm (2.7.4 => 2.8.1): Loading from cache
  - Updating laminas/laminas-code (3.5.0 => 3.5.1): Loading from cache
  - Updating symfony/asset (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/dotenv (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/property-info (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/property-access (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/options-resolver (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/intl (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/form (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/mime (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/mailer (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/security-core (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/security-http (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/security-guard (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/security-csrf (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/security-bundle (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/serializer (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/translation (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/validator (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/yaml (v5.1.8 => v5.1.9): Loading from cache
  - Updating nikic/php-parser (v4.10.2 => v4.10.3): Loading from cache
  - Updating symfony/maker-bundle (v1.24.2 => v1.25.0): Loading from cache
  - Updating symfony/stopwatch (v5.1.8 => v5.1.9): Loading from cache
  - Updating doctrine/migrations (2.3.0 => 2.3.1): Loading from cache
  - Updating symfony/http-client (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/twig-bridge (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/debug-bundle (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/monolog-bridge (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/twig-bundle (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/web-profiler-bundle (v5.1.8 => v5.1.9): Loading from cache
  - Updating symfony/css-selector (v5.1.8 => v5.1.9): Loading from cache
Generating autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
84 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

What about running composer global require symfony/thanks && composer thanks now?
This will spread some 💖  by sending a ★  to the GitHub repositories of your fellow package maintainers.

Run composer recipes at any time to see the status of your Symfony recipes.

Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
!!  
!!   // Clearing the cache for the prod environment with debug                      
!!   // false                                                                       
!!  
!!  
!!  In ORMException.php line 40:
!!                                                                                 
!!    It's a requirement to specify a Metadata Driver and pass it to Doctrine\ORM  
!!    \Configuration::setMetadataDriverImpl().                                     
!!                                                                                 
!!  
!!  cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>
!!  
!!  
Script @auto-scripts was called via post-update-cmd

It says something about Doctrine\ORM\Configuration::setMetadataDriverImpl() but I have never heard about this.

Any idea what I could do? Thanks!


EDIT:

If I change in .env.local to env=dev it works. Also the cache-cleaning. But If I try ./bin/console cache:clear --env=prod, I get this error:

$ ./bin/console cache:clear --env=prod

In ORMException.php line 40:
                                                                               
  It's a requirement to specify a Metadata Driver and pass it to Doctrine\ORM  
  \Configuration::setMetadataDriverImpl().

EDIT 2:

Maybe it is connected wit this:

config/packages/prod/doctrine.yaml

doctrine:
    orm:
        auto_generate_proxy_classes: false
        metadata_cache_driver:
            type: pool
            pool: doctrine.system_cache_pool
        query_cache_driver:
            type: pool
            pool: doctrine.system_cache_pool
        result_cache_driver:
            type: pool
            pool: doctrine.result_cache_pool
#...

Solution

When switching between environments I sometimes have to delete the cache folders manually.

When this happens, I usually do:

rm -rf var/cache/prod var/cache/dev


Answered By - Julien B.
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing