user3143015
user3143015

Reputation: 79

zend framework 2 projects conflict

I have a home server with 2 sites zf2 plus doctrine in a structure like this: var/www/site1 and var/www/site2 i think i have a conflict with namespaces. On one of two projects(site1) i receive:

Fatal error: Cannot redeclare class Doctrine\Common\Annotations\Annotation\Target in /var/www/site2/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Target.php on line 31

what should i do to not try to load classes from other project? Tank u.

Upvotes: 1

Views: 432

Answers (3)

user3143015
user3143015

Reputation: 79

So after a while i figure out what goes to this, is opcache from php, once i disable all zf2 project goes well. i don't know how to adjust to work with opcache enable

Upvotes: 3

user3143015
user3143015

Reputation: 79

The problem was from hosts file one site were to 127.0.0.1 and other to 192.168.10.20 i change and everything work normal

Upvotes: 0

OlegKrivtsov
OlegKrivtsov

Reputation: 750

This error means you included the class Doctrine\Common\Annotations\Annotation\Target two times. It is difficult to say how you could achieve that.

Zend Framework 2 uses autoloading, so this type of error is typically impossible there. To install Doctrine, you use Composer dependency manager, and it creates all the autoloading configuration for you. But, if you then copy and paste the Composer-generated code in another project, you might have problem like yours.

Upvotes: 0

Related Questions