Description
Description
We use Symfony to power hundreds of websites. Each website has its own database, but they share exactly the same code base (same vendor and app folder). The only difference is the local folder where we may setup different locales etc.
Right now, the preload file is generated and put in each website cache folder, we can not set preload config file.
Example
Ideally, I think it can be like this:
opcache.preload=/path/to/shared/var/cache/prod/App_KernelProdContainer.preload.php
(the tricky thing here is that we cannot share cache folder, each site has different template files for example so they have their own twig cache I think. Some other parameters can be different as well so ideally we only share the preload)
My current preload.php (which looks exactly the same for each site) looks like this:
<?php
// This file has been auto-generated by the Symfony Dependency Injection Component
// You can reference it in the "opcache.preload" php.ini setting on PHP >= 7.4 when preloading is desired
use Symfony\Component\DependencyInjection\Dumper\Preloader;
if (in_array(PHP_SAPI, ['cli', 'phpdbg'], true)) {
return;
}
require '/var/www/sites/2.0.0/vendor/autoload.php';
require __DIR__.'/ContainerK8hK1nt/myappMYAPP_DistributionBundle_App_MyAppKernelProdContainer.php';
$classes = [];
$classes[] = 'Oneup\FlysystemBundle\OneupFlysystemBundle';
$classes[] = 'MyApp\ResourceBundle\MyAppResourceBundle';
$classes[] = 'MyApp\UtilityBundle\MyAppUtilityBundle';
$classes[] = 'MyApp\PaymentOmniBundle\MyAppPaymentOmniBundle';
$classes[] = 'MyApp\ExtensionBundle\MyAppExtensionBundle';
$classes[] = 'MyApp\FormBundle\MyAppFormBundle';
$classes[] = 'MyApp\InventoryBundle\MyAppInventoryBundle';
$classes[] = 'MyApp\SecurityBundle\MyAppSecurityBundle';