My Drupal 8 site is repeatedly showing the following error post 8.1.2 install::
Cannot redeclare class Doctrine\Common\Annotations\Annotation\Target in n< on line 31
Reverting to the previous version of Drupal 8 resolves this error. Obviously this isn't the ideal solution.
Comments
Comment #2
cilefen commentedYou did not include the entire error in the issue summary. We don't know which file is complaining on line 31.
Comment #3
cosmo.kramer commentedThat was the full detail of the error. I will try and find more detail in the logs.
Comment #4
cilefen commentedDid you upgrade from a zip or gz download of core?
Comment #5
PLMK commentedHello I'm also getting this error on a fresh install.
Comment #6
cilefen commentedCan you provide platform details like PHP version, memory allocated, web server, opcache, OS?
Comment #7
slechtic commentedSome problem.
My configuration:
Drupal 8.1.2
PHP 5.6.22
Gentoo 4.8.4 p1.6,
PHP memory limit 512MB
Zend OPcache
nginx- EDIT: I can't confirm on nginx yet,Apache 2.2.31
Comment #8
cilefen commentedCan somebody please get the full error message into the issue summary? "n< on line 31" doesn't mean anything to me. There should be a filename. Of course, this could be a clue...
Is everybody on this issue using Nginx?
Comment #9
slechtic commentedMy experience:
I try to clear cache, then I see the message like this:
Fatal error: Cannot redeclare class Doctrine\Common\Annotations\Annotation\Target in � on line 31
Fatal error: Cannot redeclare class Doctrine\Common\Annotations\Annotation\Target in �g� on line 31
Fatal error: Cannot redeclare class Doctrine\Common\Annotations\Annotation\Target in Pz� on line 31
and the site is down for a few seconds (approx. 30)
Comment #10
slechtic commentedNow I got:
Fatal error: Cannot redeclare class Doctrine\Common\Annotations\Annotation\Target in XXX/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Target.php on line 31
Comment #11
cilefen commented@slechtic You do not know the web server?
Comment #12
slechtic commented@cilefen I know, Apache, I wanted to test on nginx but I can't confirm it.
When I disable opcache it works or when I invalidate cache for Target.php via opcache-gui, it works immediately.
Comment #13
cosmo.kramer commentedError happened for me on local environment and Dreamhost VPS.
Comment #14
cilefen commentedHow much RAM is allocated to opcache?
Comment #15
cosmo.kramer commentedI just tried updating from 8.1.1 to 8.1.3 and got the same error. This time my developer enabled show errors and the following came up:
Comment #16
bjmagar1906 commentedProblem seems to be with your system configuration. I tried Drupal 8.1.2 with both Apache and nginx Worked without any problem but i have php 7.
Comment #17
cosmo.kramer commentedAnything specific that I should be looking at re the configuration? My Dreamhost VPS in on PHP 5.6. Should I try 7?
Comment #18
cosmo.kramer commentedClassic zero support from the Drupal community :(
Comment #19
cilefen commentedI asked you a question two months ago but no reply. The community tried!
Comment #20
Forwardslash commentedI just ran into this problem upgrading a site to Drupal 8.1.8 on a Dreamhost VPS with Apache and PHP5.6. I'm not sure if it's the Dreamhost environment or PHP 5.6, but upgrading my PHP package to 7 fixed the error. Hope that helps.
Cheers!
jv
Comment #21
cilefen commentedIt sounds as though opcache still stores files that were moved or similar. Is it possible that it works if you switch back to 5.6? This is on the theory that switching versions empties the opcache.
Comment #22
johnpicozziI was having the same problem... I switched to PHP 7 and still had the issue. I was able to fix it (at least at this point) by increase my php memory limit to 256M and shutting of XCache. I think XCache and OPCache may have been conflicting.
Comment #23
Seegras commentedI think we just had the same problem, drupal 8.6.10 on php7.2 via php-fpm on nginx (Ubuntu 18.04 LTS)
We had the above error, and also this one:
2019/03/26 11:03:09 [error] 21463#21463: *40 FastCGI sent in stderr: "PHP message: Uncaught PHP Exception Drupal\Component\Plugin\Exception\PluginNotFoundException: "The "language-user-admin" plugin does not exist." at /home/user/httpdocs/web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php line 52" while reading response header from upstream, client: 192.168.1.1, server: webserver.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-www-data.sock:", host: "webserver.com"
We solved it by turning off opcache (and reinstalling plugins et.al. via composer and drush from the commandline).
Comment #26
pameeela commentedMost people on this thread seem to have resolved the issue. @cosmo.kramer did you find a resolution for your site? If so can you post a comment with the resolution? Or if you are still seeing it, can you reply to cilefen's question in #14?
Comment #27
lendudeCleaning up old bugs.
Sounds like this was an OPCache problem for most people.
If this is still an issue feel free to add some steps to reproduce this on a clean Drupal install and reopen this.