D
D
Denis2015-11-13 17:25:41
PHP
Denis, 2015-11-13 17:25:41

php-fpm and symfony caching paths on subdomains?

Similar question
stackoverflow.com/questions/27637369/nginx-with-mu...
But there are folders, and I have subdomains...
There is an nginx config where:
Symfony standard app 1 and Symfony standard app 2
2 separate applications on Symfony.
They differ only in the domain name and root directory.
The first is the main domain.
The second is a subdomain.
Default - subdomain with one index.php file

# Symfony standard app 1
server {
    server_name example.com;
    root /foo/.../web;
    location / {
        try_files $uri /app.php$is_args$args;
    }
    location ~ ^/(app_dev|config)\.php(/|$) {
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
    # ...
}

# Symfony standard app 2
server {
    server_name bar.example.com;
    root /bar/.../web;
    # ...
}

# Default /baz/index.php   <?php echo 1; ?>
server {
    server_name baz.example.com;
    root /baz;
    location / {
        try_files $uri /index.php;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

When php-fpm is restarted, the following happens.
The first time you visit example.com, 1 app is launched.
Then, in a new browser tab, when you navigate to bar.example.com, application 2 is launched, but
everything in the vendor (composer) folder is pulled out of example.com.
And baz.example.com (just index.php) works as expected.
If you restart php-fpm.
And update bar.example.com first, then the situation repeats for example.com.
The error is quite interesting.
in AppKernel in method
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new Acme\Bundle\AcmeBundle(), 
            // ..
        );

The Symfony error is thrown that Acme\Bundle\AcmeBundle was not found.
Valid for an application that will be initialized second.
Chrome, Firefox, curl, wget - doesn't matter...
But
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        var_dump(new Acme\Bundle\AcmeBundle());
        exit();

        $bundles = array(
            new Acme\Bundle\AcmeBundle(), 
            // ..
        );

Displays an instance of this bundle.
Dumped the paths in both AppKernel and bootstrap.php.cache and others... The paths are normal.
For me, this is an extremely incomprehensible situation.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question