Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Allow specifying the location of auto-generated preload file #39061

Copy link
Copy link
Closed
@yellow1912

Description

@yellow1912
Issue body actions

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';

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.