5

Where is the service container compiled to in Drupal 8, in the database or in a file?

7
  • What do you mean by "service file compiled"? Are you referring to D8 service objects? Jan 28, 2017 at 23:56
  • Yes, i think that Drupal like symfony compiled each services interpreting the compiler pass ecc...
    – BOES
    Jan 29, 2017 at 0:07
  • 1
    In a protected directory inside the site's configured files path php/**/ unless cache is turned off then it won't use it (i.e. for development)
    – mradcliffe
    Jan 29, 2017 at 0:31
  • 2
    @mradcliffe, that's the normal Symfony way to do it, compile the service container to a single php file. For better performance Drupal as changed this and stores it now in database in the table cache_container. How to take a look inside: drupal.org/node/2540430
    – 4uk4
    Jan 29, 2017 at 9:04
  • 1
    This appears to have been closed a bit prematurely, @4k4 care to post that as an answer?
    – Clive
    Jan 29, 2017 at 22:33

1 Answer 1

2

As @mradcliffe described in a commment, the normal Symfony way to compile and cache the service container is a single php file. Drupal used this until Sep. 2015. If you have an older installation, you still find the compiled container in php/**/, because it was never deleted by newer versions.

For better performance Drupal has changed this and stores it now in database in the table cache_container. The change record and how to take a look inside the container to debug it:

Change record: The service container definition is now stored in the database by default

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.