diff --git a/configuration/override_dir_structure.rst b/configuration/override_dir_structure.rst index e5dff35b6d0..21fd76ac39d 100644 --- a/configuration/override_dir_structure.rst +++ b/configuration/override_dir_structure.rst @@ -118,6 +118,19 @@ named ``APP_CACHE_DIR`` whose value is the full path of the cache folder. its own cached configuration files, and so each needs its own directory to store those cache files. +In case you have multiple frontend servers using the same shared filesystem, you +can make use of the :method:`Symfony\\Component\\HttpKernel\\Kernel::getShareDir` method to +get a shared directory for cache and shared data. The shared directory can be set +by overriding an environment variable named ``APP_SHARE_DIR`` whose value is the full +path of the shared folder. This directory is also accessible as a container parameter +named ``%kernel.share_dir%``. + +.. versionadded:: 7.4 + + The ``Kernel::getShareDir()`` method, the ``%kernel.share_dir`` parameter and + the support for the ``APP_SHARE_DIR`` environment variable were introduced + in Symfony 7.4. + .. _override-logs-dir: Override the Log Directory diff --git a/reference/configuration/kernel.rst b/reference/configuration/kernel.rst index b7596182906..443fb98ef31 100644 --- a/reference/configuration/kernel.rst +++ b/reference/configuration/kernel.rst @@ -347,6 +347,22 @@ servers support it, and you have to use a long-running web server like `FrankenP This parameter stores the value of :ref:`the framework.secret parameter `. +``kernel.share_dir`` +-------------------- + +**type**: ``string`` **default**: ``$this->getCacheDir()`` + +This parameter stores the absolute path of the shared cache directory of your Symfony +application. The default value is the current cache directory. + +This value is also exposed via the :method:`Symfony\\Component\\HttpKernel\\Kernel::getShareDir` +method of the kernel class, which you can override to return a different value. + +.. versionadded:: 7.4 + + The ``Kernel::getShareDir()`` method and the ``%kernel.share_dir`` parameter + were introduced in Symfony 7.4. + ``kernel.trust_x_sendfile_type_header`` ---------------------------------------