Skip to content

PHP Fatal error: Cannot redeclare with opcache.preload and Composer autoload between releases #3590

@gremo

Description

@gremo
  • Deployer version: 7.3.1
  • Deployment OS: Centos 7

My project is Symfony based, and uses the following opcache configuration:

opcache.preload = /var/www/vhosts/myproject/httpdocs/current/config/preload.php

It works the first time I activate the configuration. Next time I'll deply a new version, you got errors in PHP logs:

AH01071: Got error 'PHP message: PHP Fatal error: Cannot redeclare composerRequiree7dcbbd7b36b37e14629ddf6c0ff22ac() (previously declared in /var/www/vhosts/myproject/httpdocs/releases/1/vendor/composer/autoload_real.php:73) in /var/www/vhosts/myproject/httpdocs/releases/2/vendor/composer/autoload_real.php on line 73'

As you can see the release 1 "conflict" with release 2 because the same function is redeclared and still in memory (I think).

Adding after('deploy:symlink', 'cachetool:clear:opcache') doesn't help to solve the issue.

What I'missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions