8000 ParameterNotFoundException: You have requested a non-existent parameter "kernel.bundles_metadata" · Issue #21646 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

ParameterNotFoundException: You have requested a non-existent parameter "kernel.bundles_metadata" #21646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kimbab14 opened this issue Feb 17, 2017 · 49 comments

Comments

@kimbab14
Copy link
kimbab14 commented Feb 17, 2017
Q A
Bug report? no
Feature request? no
BC Break report? no
RFC? no
Symfony version 2.7.24

I tried deleting the Symfony cache because it is giving me an error and now my web page doesn't want to start and i am getting the following error:
PHP Fatal error: Uncaught Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException: You have requested a non-existent parameter "kernel.bundles_metadata".

Any help is appreciated as I am trying to sort it out now for 2 days.

@javiereguiluz
Copy link
Member

This parameter was introduced in 2.7.23, 2.8.16, 3.1.9 and 3.2.2 versions. It's created and managed by Symfony ... so it should be created automatically when building the container. Are you doing some advanced things with the container in your app?

@kimbab14
Copy link
Author

Hi Sir, nope. I am using 2.7.24 version, what I did is just deleted the cache in the prod and then suddenly I got that error. My application is deployed at Apache server.

@kimbab14
Copy link
Author

@javiereguiluz is it possible to update the vendor folder sir?

@javiereguiluz
Copy link
Member

If you have the proper permissions for the cache/ folder, in theory you could do a rm -fr app/cache/* and then Symfony would recreate the production cache automatically.

@kimbab14
Copy link
Author

@javiereguiluz did that sir but then still getting this kernel.bundle_metadata.

@javiereguiluz
Copy link
Member

The quick temporary solution is to install the last Symfony version that doesn't include that parameter. Open composer.json and use 2.7.22 as the version of Symfony. Then you can do a composer update symfony/symfony to get the old.but.working Symfony version.

Then, try to reproduce the error in your local computer. As I said before, this parameter is something that Symfony creates and manages itself automatically ... so Symfony developers should not care about it.

@xabbuh
Copy link
Member
xabbuh commented Feb 17, 2017

@kimbab14 Can you please show the output of composer show for your application?

@stof
Copy link
Member
stof commented Feb 17, 2017

If you don't want to show all packages you are using, for whatever reason, the output of composer show "symfony/*" would be a start

@eldarberserker
Copy link
eldarberserker commented Feb 17, 2017

using symfony 3.1.10 got the same problem, using centos with apache 2.4, php 5.6.30 (some hosting, i don' have access to a shell... so i don't have composer available) , when i'm in dev ambient (i edited app_dev.php so i can run it in production server), i have no problem at all. I deleted everything inside var/cache/ but in production, i get this error. can't recreate the error on my local, because in my local i have debian, apache 2.4, php 7 so no problems at all.

@xanxiver
Copy link

I encounter this problem once

Running the following command seems to fix it
composer run post-install-cmd

@Laurent001
Copy link
Laurent001 commented Feb 23, 2017

@javiereguiluz

Dev in windows 10 with php 7.1.1 (xampp):

  • symfony 3.1.2 => same error
  • symfony 3.1.8 => OK but requests slow or very slow

@jeecode
Copy link
jeecode commented Feb 23, 2017

Amazon Linux AMI 2016.09.1
PHP 7.0.14

symfony 3.2.3 => same error
symfony 3.2.1 => OK

@xabbuh
Copy link
Member
xabbuh commented Feb 23, 2017

Anyone willing to provide the output of composer show or composer show symfony/*?

@Laurent001
Copy link

Sorry mistake in my previous message. Not 3.1.2 but 3.2.1:

Xampp with php 7.1.1 and
3.2.1: error
3.1.8: OK but slow

@jeecode
Copy link
jeecode commented Feb 23, 2017

composer show
aws/aws-sdk-php 3.22.9
doctrine/annotations v1.2.7
doctrine/cache v1.6.1
doctrine/collections v1.3.0
doctrine/common v2.6.2
doctrine/dbal v2.5.12
doctrine/doctrine-bundle 1.6.7
doctrine/doctrine-cache-bundle 1.3.0
doctrine/inflector v1.1.0
doctrine/instantiator 1.0.5
doctrine/lexer v1.0.1
doctrine/orm v2.5.6
guzzlehttp/guzzle 6.2.2
guzzlehttp/promises v1.3.1
guzzlehttp/psr7 1.3.1
incenteev/composer-parameter-handler v2.1.2
itbz/fpdf 1.7.3
itbz/fpdi dev-master 004ce22
jdorn/sql-formatter v1.2.17
monolog/monolog 1.22.0
mtdowling/jmespath.php 2.4.0
paragonie/random_compat v2.0.4
psr/cache 1.0.1
psr/http-message 1.0.1
psr/log 1.0.2
sensio/distribution-bundle v5.0.18
sensio/framework-extra-bundle v3.0.22
sensio/generator-bundle v3.1.2
sensiolabs/security-checker v4.0.1
swiftmailer/swiftmailer v5.4.6
symfony/monolog-bundle v2.12.1
symfony/phpunit-bridge v2.8.17
symfony/polyfill-intl-icu v1.3.0
symfony/polyfill-mbstring v1.3.0
symfony/polyfill-php56 v1.3.0
symfony/polyfill-php70 v1.3.0
symfony/polyfill-util v1.3.0
symfony/swiftmailer-bundle v2.4.2
symfony/symfony v3.2.1
twig/twig v1.31.0

composer show symfony/*
symfony/monolog-bundle v2.12.1
symfony/phpunit-bridge v2.8.17
symfony/polyfill-intl-icu v1.3.0
symfony/polyfill-mbstring v1.3.0
symfony/polyfill-php56 v1.3.0
symfony/polyfill-php70 v1.3.0
symfony/polyfill-util v1.3.0
symfony/swiftmailer-bundle v2.4.2
symfony/symfony v3.2.1

@xabbuh
Copy link
Member
xabbuh commented Feb 23, 2017

Can you check which bundle is trying to access the parameter? #19586 wasn't part of Symfony version >= 3.2.2 (which also means that no internal Symfony code is accessing this parameter).

@JProffitt71
Copy link
JProffitt71 commented Feb 23, 2017

Edit: I think my issue was due to Symfony's Kernel.php being open in my sublime text instance when I upgraded, which would explain why reinstalling worked.

I encountered this issue when upgrading Symfony from 3.0.0 to 3.2.2 in my dev environment. I was able to get around it by deleting the vendor/symfony folder and running composer update to reinstall Symfony.

The environment remained the same before and after, PHP 7.0.14 with Apache 2.4.23.

composer show
behat/transliterator v1.1.0 String transliterator
doctrine/annotations v1.3.1 Docblock Annotations Parser
doctrine/cache v1.6.1 Caching library offering an object-oriented API for many cache backends
doctrine/collections v1.4.0 Collections Abstraction library
doctrine/common v2.7.2 Common Library for Doctrine projects
doctrine/dbal v2.5.12 Database Abstraction Layer
doctrine/doctrine-bundle 1.6.7 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle 1.3.0 Symfony Bundle for Doctrine Cache
doctrine/inflector v1.1.0 Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator 1.0.5 A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm v2.5.6 Object-Relational-Mapper for PHP
friendsofsymfony/rest-bundle 2.1.1 This Bundle provides various tools to rapidly develop RESTful API's with Symfony
friendsofsymfony/user-bundle 2.0.0-beta2 Symfony FOSUserBundle
gedmo/doctrine-extensions v2.4.26 Doctrine2 behavioral extensions
incenteev/composer-parameter-handler v2.1.2 Composer script handling your ignored parameter file
jdorn/sql-formatter v1.2.17 a PHP SQL highlighting library
kriswallsmith/assetic v1.4.0 Asset Management for PHP
monolog/monolog 1.22.0 Sends your logs to files, sockets, inboxes, databases and various web services
mtdowling/cron-expression v1.2.0 CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
myclabs/deep-copy 1.6.0 Create deep copies (clones) of your objects
ornicar/gravatar-bundle 1.1.4 This bundles provides a Gravatar API various utilities to work with it in templates
paragonie/random_compat v2.0.4 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phpdocumentor/reflection-common 1.0 Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock 3.1.1 With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.
phpdocumentor/type-resolver 0.2.1
phpspec/prophecy v1.6.2 Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage 4.0.6 Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator 1.4.2 FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template 1.2.1 Simple template engine.
phpunit/php-timer 1.0.8 Utility class for timing
phpunit/php-token-stream 1.4.10 Wrapper around PHP's tokenizer extension.
phpunit/phpunit 5.7.14 The PHP Unit Testing framework.
phpunit/phpunit-mock-objects 3.4.3 Mock Object library for PHPUnit
psr/cache 1.0.1 Common interface for caching libraries
psr/log 1.0.2 Common interface for logging libraries
sebastian/code-unit-reverse-lookup 1.0.0 Looks up which function or method a line of code belongs to
sebastian/comparator 1.2.4 Provides the functionality to compare PHP values for equality
sebastian/diff 1.4.1 Diff implementation
sebastian/environment 2.0.0 Provides functionality to handle HHVM/PHP environments
sebastian/exporter 2.0.0 Provides the functionality to export PHP variables for visualization
sebastian/global-state 1.1.1 Snapshotting of global state
sebastian/object-enumerator 2.0.1 Traverses array structures and object graphs to enumerate all referenced objects
sebastian/recursion-context 2.0.0 Provides functionality to recursively process PHP variables
sebastian/resource-operations 1.0.0 Provides a list of PHP built-in functions that operate on resources
sebastian/version 2.0.1 Library that helps with managing the version number of Git-hosted PHP projects
sensio/distribution-bundle v5.0.18 Base bundle for Symfony Distributions
sensio/framework-extra-bundle v3.0.22 This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle v3.1.2 This bundle generates code for you
sensiolabs/security-checker v4.0.1 A security checker for your composer.lock
simplethings/entity-audit-bundle v1.0.2 Audit for Doctrine Entities
stof/doctrine-extensions-bundle v1.2.2 Integration of the gedmo/doctrine-extensions with Symfony2
swiftmailer/swiftmailer v5.4.6 Swiftmailer, free feature-rich PHP mailer
symfony/assetic-bundle v2.8.1 Integrates Assetic into Symfony2
symfony/monolog-bundle v3.0.3 Symfony MonologBundle
symfony/phpunit-bridge v3.2.4 Symfony PHPUnit Bridge
symfony/polyfill-apcu v1.3.0 Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-intl-icu v1.3.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring v1.3.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56 v1.3.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70 v1.3.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util v1.3.0 Symfony utilities for portability of PHP codes
symfony/swiftmailer-bundle v2.4.2 Symfony SwiftmailerBundle
symfony/symfony v3.2.2 The Symfony PHP framework
twig/twig v1.31.0 Twig, the flexible, fast, and secure template language for PHP
webmozart/assert 1.2.0 Assertions to validate method input/output with nice error messages.
willdurand/jsonp-callback-validator v1.1.0 JSONP callback validator.
willdurand/negotiation v2.2.1 Content Negotiation tools for PHP provided as a standalone library.

@jeecode
Copy link
jeecode commented Feb 23, 2017

I am a nooby and dont know how I can check which bundle is trying to access, maybe the complete error helps you? Otherwise please provide how I can check... sorry

PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException: You have requested a non-existent parameter "kernel.bundles_metadata". in /var/www/xxxxxxx_1.0/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:100\nStack trace:\n#0 /var/www/xxxxxxx_1.0/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php(56): Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->get('kernel.bundles_...')\n#1 /var/www/xxxxxxx_1.0/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php(130): Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag->get('kernel.bundles_...')\n#2 /var/www/xxxxxxx_1.0/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php(972): Symfony\Component\DependencyInjection\Container->getParameter('kernel.bundles_...')\n#3 /var/www/xxxxxxx_1.0/vendor/symfony/symfony/src/Symfony/Bundle/Framewor in /var/www/xxxxxxx_1.0/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php on line 100

@xabbuh
Copy link
Member
xabbuh commented Feb 23, 2017

This looks weird as the code from the FrameworkBundle triggering the issue was not part of the 3.2.1 release. Can you show what happens when you run composer install?

@Laurent001
Copy link

I have just deleted the vendor folder and reinstall everything with symfony 3.2.4 and still the error printed by @jeecode. Only in prod env.

composer show:

coresphere/console-bundle            0.5.0              This bundle allows you accessing the symfony2 console via ...
doctrine/annotations                 v1.3.1             Docblock Annotations Parser
doctrine/cache                       v1.6.1             Caching library offering an object-oriented API for many c...
doctrine/collections                 v1.4.0             Collections Abstraction library
doctrine/common                      v2.7.2             Common Library for Doctrine projects
doctrine/data-fixtures               v1.2.2             Data Fixtures for all Doctrine Object Managers
doctrine/dbal                        v2.5.12            Database Abstraction Layer
doctrine/doctrine-bundle             1.6.7              Symfony DoctrineBundle
doctrine/doctrine-cache-bundle       1.3.0              Symfony Bundle for Doctrine Cache
doctrine/doctrine-fixtures-bundle    2.3.0              Symfony DoctrineFixturesBundle
doctrine/inflector                   v1.1.0             Common String Manipulations with regard to casing and sing...
doctrine/instantiator                1.0.5              A small, lightweight utility to instantiate objects in PHP...
doctrine/lexer                       v1.0.1             Base library for a lexer that can be used in Top-Down, Rec...
doctrine/orm                         v2.5.6             Object-Relational-Mapper for PHP
friendsofsymfony/jsrouting-bundle    1.6.0              A pretty nice way to expose your Symfony2 routing to clien...
friendsofsymfony/user-bundle         dev-master 8a8f79e Symfony FOSUserBundle
incenteev/composer-parameter-handler v2.1.2             Composer script handling your ignored parameter file
jdorn/sql-formatter                  v1.2.17            a PHP SQL highlighting library
knplabs/knp-menu                     2.2.0              An object oriented menu library
knplabs/knp-menu-bundle              2.1.3              This bundle provides an integration of the KnpMenu library
kriswallsmith/assetic                v1.4.0             Asset Management for PHP
monolog/monolog                      1.22.0             Sends your logs to files, sockets, inboxes, databases and ...
paragonie/random_compat              v2.0.4             PHP 5.x polyfill for random_bytes() and random_int() from ...
psr/cache                            1.0.1              Common interface for caching libraries
psr/log                              1.0.2              Common interface for logging libraries
sensio/distribution-bundle           v5.0.18            Base bundle for Symfony Distributions
sensio/framework-extra-bundle        v3.0.22            This bundle provides a way to configure your controllers w...
sensio/generator-bundle              v3.1.2             This bundle generates code for you
sensiolabs/security-checker          v4.0.1             A security checker for your composer.lock
swiftmailer/swiftmailer              v5.4.6             Swiftmailer, free feature-rich PHP mailer
symfony/assetic-bundle               v2.8.1             Integrates Assetic into Symfony2
symfony/monolog-bundle               v2.12.1            Symfony MonologBundle
symfony/phpunit-bridge               v3.2.4             Symfony PHPUnit Bridge
symfony/polyfill-apcu                v1.3.0             Symfony polyfill backporting apcu_* functions to lower PHP...
symfony/polyfill-intl-icu            v1.3.0             Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring            v1.3.0             Symfony polyfill for the Mbstring extension
symfony/polyfill-php56               v1.3.0             Symfony polyfill backporting some PHP 5.6+ features to low...
symfony/polyfill-php70               v1.3.0             Symfony polyfill backporting some PHP 7.0+ features to low...
symfony/polyfill-util                v1.3.0             Symfony utilities for portability of PHP codes
symfony/swiftmailer-bundle           v2.4.2             Symfony SwiftmailerBundle
symfony/symfony                      v3.2.4             The Symfony PHP framework
twig/extensions                      v1.4.1             Common additional features for Twig that do not directly b...
twig/twig                            v2.1.0             Twig, the flexible, fast, and secure template language for...
willdurand/jsonp-callback-validator  v1.1.0             JSONP callback validator.

@jeecode
Copy link
jeecode commented Feb 23, 2017

composer install for version 3.2.1 (no issues, dev and prod work fine)

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files

Incenteev\ParameterHandler\ScriptHandler::buildParameters
Updating the "app/config/parameters.yml" file
Some parameters are missing. Please provide them.
database_host (127.0.0.1):
database_port (null):
database_name (symfony):
database_user (root):
database_password (null):
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache

[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: date_default_timezone_get(): It is not safe to rely on the system'
s timezone settings. You are required to use the date.timezone setting or
the date_default_timezone_set() function. In case you used any of those me
thods and you are still getting this warning, you most likely misspelled th
e timezone identifier. We selected the timezone 'UTC' for now, but please s
et date.timezone to select your timezone.

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] [--]

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exc 8000 eption

[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:

[Symfony\Component\Debug\Exception\ContextErrorException]                                                                                                       
Warning: date_default_timezone_get(): It is not safe to rely on the system'                                                                                     
s timezone settings. You are *required* to use the date.timezone setting or                                                                                     
 the date_default_timezone_set() function. In case you used any of those me                                                                                     
thods and you are still getting this warning, you most likely misspelled th                                                                                     
e timezone identifier. We selected the timezone 'UTC' for now, but please s                                                                                     
et date.timezone to select your timezone.                                                                                                                       

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] [--]
.

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] []...




composer install for version 3.2.4 (dev ok, prod not working)

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
Some parameters are missing. Please provide them.
database_host (127.0.0.1):
database_port (null):
database_name (symfony):
database_user (root):
database_password (null):

Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache

[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: date_default_timezone_get(): It is not safe to rely on the system'
s timezone settings. You are required to use the date.timezone setting or
the date_default_timezone_set() function. In case you used any of those me
thods and you are still getting this warning, you most likely misspelled th
e timezone identifier. We selected the timezone 'UTC' for now, but please s
et date.timezone to select your timezone.

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] [--]

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception

[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:

[Symfony\Component\Debug\Exception\ContextErrorException]                                                                                                       
Warning: date_default_timezone_get(): It is not safe to rely on the system'                                                                                     
s timezone settings. You are *required* to use the date.timezone setting or                                                                                     
 the date_default_timezone_set() function. In case you used any of those me                                                                                     
thods and you are still getting this warning, you most likely misspelled th                                                                                     
e timezone identifier. We selected the timezone 'UTC' for now, but please s                                                                                     
et date.timezone to select your timezone.                                                                                                                       

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] [--]
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] []...

@xabbuh
Copy link
Member
xabbuh commented Feb 23, 2017

It's possible that you run into some issues with existing Opcache. Do you experience the issue only when accessing the application over the web or on the CLI as well? Did you make sure to clear the Opcache?

@jeecode
Copy link
jeecode commented Feb 23, 2017

I am only having the problem on my web-server (in prod environment), locally there is no problem (dev + prod).

I am always clearing my cache via remote on the webserver:
sudo rm -r /var/www/xxxxxx_1.0/var/cache/*

Locally I just delete the dev or prod directory in /var/cache/.

The problem first arised today after clearing the cache, since then I cleared the cache several times for sure but only the downgrade to version 3.2.1 made the error disappear.

@xabbuh
Copy link
Member
xabbuh commented Feb 24, 2017

Deleting the cache may not be enough. Try to also clear your Opcache (doing that whenever you deploy your application is a good idea). But note that your CLI and web server environment do not share the Opcache and that you will need to clear them separately (reloading PHP FPM may be the easiest way to do so).

@jeecode
Copy link
jeecode commented Feb 25, 2017

Yep, that was it!

Works now:
Amazon Linux AMI 2016.09.1
PHP 7.0.14
Symfony 3.2.4 (prod-environment)

First I had to delete everything in the cache directory via:
sudo rm -r /var/www/xxxx_1.0/var/cache/*
(Otherwise the cache:clear command did only work via sudo...)

Then use the symfony command to clean the cache:
bin/console cache:clear --env=prod

[OK] Cache for the "prod" environment (debug=false) was successfully cleared.

Important!
When I now clean my cache only via sudo rm -r /var/www/xxxx_1.0/var/cache/* and then reload my page the prod directory in the cache directory is created with permissions 755 and user apache and the You have requested a non-existent parameter "kernel.bundles_metadata". in error occurs.

Then the bin/console cache:clear --env=prod doesnt work without sudo:

[RuntimeException]
Unable to write in the cache directory (/var/www/xxxx_1.0/var/cache/prod)

So from now on I will always clean my cache like that:
sudo rm -r /var/www/xxxx_1.0/var/cache/*
bin/console cache:clear --env=prod

Or maybe even from now on the bin/console cache:clear --env=prod is enough, I will see...

I didn't use bin/console cache:clear --env=prod in the past because I always had some errors, but with this version it seems to work for me...

@Laurent001
Copy link

Not working for me with symfony 3.2.4 in local (windows 10 with xampp php 7.1.1)
Dev OK
Prod KO

@xabbuh
Copy link
Member
xabbuh commented Feb 26, 2017

@Laurent001 What steps did you perform besides clearing the cache?

@jeecode The steps you describe are not related to Opcache, but only to Symfony's application cache. And not clearing that cache is indeed a bad idea especially when classes from the framework that have been updated in the vendors directory are inlined in the class cache.

@Laurent001
Copy link
Laurent001 commented Feb 26, 2017
  • delete manually the cache/dev and cache/prod folders
  • bin/console cache:clear --env=prod (jeecode advice) => no change

@xabbuh
Copy link
Member
xabbuh commented Feb 26, 2017

Please make sure to also clear your Opcache to be actually sure that your issue is not related to it (see also #21646 (comment)).

@Laurent001
Copy link

I have just checked and opcache was not enable in my php 7.1.1.

@rahit
Copy link
rahit commented Mar 3, 2017

Confirming issue on v2.8.17.
Neither removing and clearing cache, vendor directory nor composer update/install helped.

@xabbuh
Copy link
Member
xabbuh commented Mar 5, 2017

Can anyone of you provide a reproducable example (best based on the Symfony Standard Edition)? And did you all make sure to clear the Opcace (or other similar bytecode caches)? Bear in mind that PHP-FPM (or the PHP Apache module) do not use the same Opcache as the PHP executable on the CLI uses.

@tutecipo
Copy link
tutecipo commented Mar 7, 2017

I had same issue in prod with Symfony 2.8.16, resolved by moving back to 2.8.15

@Laurent001
Copy link
Laurent001 commented Mar 8, 2017

I have installed a debian jessie (VM) with php 7.0 and symfony 3.2.4. Windows 10 as host.
I have done like jeecode:
So from now on I will always clean my cache like that: sudo rm -r /var/www/xxxx_1.0/var/cache/* bin/console cache:clear --env=prod

I restart apache, flush opcache but I still have the problem.

ParameterNotFoundException in ParameterBag.php line 100: You have requested a non-existent parameter "kernel.bundles_metadata".

in ParameterBag.php line 100
at ParameterBag->get('kernel.bundles_metadata') in Container.php line 130
at Container->getParameter('kernel.bundles_metadata') in FrameworkExtension.php line 962
at FrameworkExtension->getValidatorMappingFiles(object(ContainerBuilder)) in FrameworkExtension.php line 912
at FrameworkExtension->registerValidationConfiguration(array('enable_annotations' => true, 'enabled' => true, 'static_method' => array('loadValidatorMetadata'), 'translation_domain' => 'validators', 'strict_email' => false), object(ContainerBuilder), object(XmlFileLoader)) in FrameworkExtension.php line 163
at FrameworkExtension->load(array(array('translator' => array('fallback' => 'fr'), 'secret' => 'codesecretdecabetio', 'router' => array('resource' => '/var/www/prendreunrdv.com/app/config/routing.yml', 'strict_requirements' => null), 'form' => null, 'csrf_protection' => null, 'validation' => array('enable_annotations' => true), 'templating' => array('engines' => array('twig')), 'default_locale' => 'fr', 'trusted_proxies' => null, 'session' => array('cookie_lifetime' => 10000), 'fragments' => null, 'http_method_override' => true)), object(ContainerBuilder)) in MergeExtensionConfigurationPass.php line 59
at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in MergeExtensionConfigurationPass.php line 39
at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in Compiler.php line 120
at Compiler->compile(object(ContainerBuilder)) in ContainerBuilder.php line 565
at ContainerBuilder->compile() in bootstrap.php.cache line 1622
at Kernel->initializeContainer() in bootstrap.php.cache line 1410
at Kernel->boot() in bootstrap.php.cache line 1441
at Kernel->handle(object(Request)) in app.php line 28

@xabbuh
Copy link
Member
xabbuh commented Mar 8, 2017

I don't know how we could help you without a reproducable project. However, could please try to debug why the getKernelParameters() method doesn't seem to get called in your case when the cache is empty or produce the wrong result?

@Laurent001
Copy link

Fixed !
I went to the symfony page to see the master branch (github). I copied/pasted app.dev.php and app.php in my debian to start from scratch. After minor customisation (IP), everything is ok with 3.2.4.

My guess:
I am using php 7 and now there is a condition to check php version to load or not some caches:

app_dev.php:
$kernel = new AppKernel('dev', true); if (PHP_VERSION_ID < 70000) { $kernel->loadClassCache(); }

app.php:
$loader = require __DIR__.'/../app/autoload.php'; if (PHP_VERSION_ID < 70000) { include_once __DIR__.'/../var/bootstrap.php.cache'; }

@Haehnchen
Copy link
Contributor

Got the same issue after a composer update v3.2.1 => v3.2.6. Maybe someone is able to extract something on composer log.

  - Updating monolog/monolog (1.22.0 => 1.22.1): Downloading (100%) Extracting archive
  - Updating twig/twig (v1.30.0 => v1.32.0): Downloading (100%) Extracting archive
  - Updating paragonie/random_compat (v2.0.4 => v2.0.10): Downloading (100%) Extracting archive
  - Updating symfony/symfony (v3.2.1 => v3.2.6): Downloading (100%) Extracting archive
  - Updating doctrine/collections (v1.3.0 => v1.4.0): Downloading (100%) Extracting archive
  - Updating doctrine/annotations (v1.3.1 => v1.4.0): Downloading (100%) Extracting archive
  - Updating doctrine/common (v2.7.1 => v2.7.2): Downloading (100%) Extracting archive
  - Updating symfony/monolog-bundle (3.0.1 => v3.0.3): Downloading (100%) Extracting archive
  - Updating sensiolabs/security-checker (v4.0.0 => v4.0.2): Downloading (100%) Extracting archive
  - Updating sensio/distribution-bundle (v5.0.16 => v5.0.18): Downloading (100%) Extracting archive
  - Updating sensio/framework-extra-bundle (v3.0.18 => v3.0.23): Downloading (100%) Extracting archive
  - Updating symfony-cmf/routing (1.4.0 => 2.0.0): Downloading (100%) Extracting archive
  - Updating guzzlehttp/psr7 (1.3.1 => 1.4.1): Downloading (100%) Extracting archive
  - Updating guzzlehttp/guzzle (6.2.2 => 6.2.3): Downloading (100%) Extracting archive
  - Updating white-october/pagerfanta-bundle (v1.0.7 => v1.0.8): Downloading (100%) Extracting archive
  - Updating sensio/generator-bundle (v3.1.2 => v3.1.3): Downloading (100%) Extracting archive
  - Updating symfony/phpunit-bridge (v3.2.1 => v3.2.6): Downloading (100%) Extracting archive
  - Updating sebastian/object-enumerator (2.0.0 => 2.0.1): Downloading (100%) Extracting archive
  - Updating sebastian/comparator (1.2.2 => 1.2.4): Downloading (100%) Extracting archive
  - Updating phpunit/php-timer (1.0.8 => 1.0.9): Downloading (100%) Extracting archive
  - Updating sebastian/code-unit-reverse-lookup (1.0.0 => 1.0.1): Downloading (100%) Extracting archive
  - Updating phpunit/php-token-stream (1.4.9 => 1.4.11): Downloading (100%) Extracting archive
  - Updating phpunit/php-code-coverage (4.0.4 => 4.0.7): Downloading (100%) Extracting archive
  - Updating phpspec/prophecy (v1.6.2 => v1.7.0): Downloading (100%) Extracting archive
  - Updating myclabs/deep-copy (1.5.5 => 1.6.0): Downloading (100%) Extracting archive
  - Updating phpunit/phpunit (5.7.5 => 5.7.15): Downloading (100%) Extracting archive
  - Installing psr/container (1.0.0): Downloading (100%) Extracting archive
  - Updating container-interop/container-interop (1.1.0 => 1.2.0): Downloading (100%) Extracting archive

@Haehnchen
Copy link
Contributor

so this is not really an "issue", but was introduced in v3.2.2 via fef3146. This changes need a fresh bootstrap.php.cache. So check your composer update commands or deployment for:

Generating autoload files
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap

@netcraft-devops
Copy link

Confirming issue on v2.8.18.
Neither removing and clearing cache, vendor directory nor composer update/install helped.

@xabbuh
Copy link
Member
xabbuh commented Mar 24, 2017

Did you rebuilt the bootstrap.php.cache file? Do you use Opcache? And if so, did you clear it?

@netcraft-devops
Copy link

@xabbuh How do I rebuild the bootstrap.php.cache file? I did clear the Opcache

@netcraft-devops
Copy link

@xabbuh I copied the bootstrap.php.cache from dev (2.8.18) to prod (2.8.18) and it works

@xabbuh
Copy link
Member
xabbuh commented Apr 14, 2017

I am closing the issue as it turns out that in all cases where it was possible to reproduce the issue some kind of cache (being it Opcache or the bootstrap.php.cache file) was the culprit.

@xabbuh xabbuh closed this as completed Apr 14, 2017
@tayhimself
Copy link

Resolved by clearing opcache after deleting app/bootstrap.php.cache, app/console cache:clear, manually deleting cache files etc. didn't work.

<?php opcache_reset(); ?>

@dsentker
Copy link

I had the same issue. Locally, I updated to Symfony 3.1.10 via composer, and then uploaded the project to the prod environment. Here I received the o.g. Error message. Accessing the app_dev.php the error did not appear.

It did not help to clear the cache (file system, console, etc.)

Solution: I uploaded the /var/bootstrap.php.cache file from the local environment, and the error did not show up anymore.

@ajaxray
Copy link
ajaxray commented Jul 30, 2017

On Symfony 2.8.22, I had the issue after removing cache directory.
Then regenerating the bootstrap.php.cache using the following command resolved the issue -

composer run-script post-update-cmd

@IvanAlekseevichPopov
Copy link

symfony 2.8.30 - deleting app/bootstrap.php.cache helps me.

@votemike
Copy link
Contributor

I'm getting this problem when upgrading from v3.4.2 to v3.4.11. I can't find any app/bootstrap.php.cache to delete.
Any ideas?

@dvdknaap
Copy link
dvdknaap commented Dec 17, 2018

Im my case i had to install symfony/translation to fix it.

composer require symfony/translation

Before i run above command i removed the cache as well so this could be helping as well to fix it.
rm var/cache/* -Rf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0