Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Sites - PHP Fatal Error: Cannot declare class because name is already in use #1880

Closed
kurtaschliman opened this issue Nov 16, 2018 · 5 comments

Comments

@kurtaschliman
Copy link

Info:

  • Docker version ($ docker --version): 18.06.1-ce, build e68fc7a
  • Laradock commit ($ git rev-parse HEAD): 0ed5487
  • System info (Mac, PC, Linux): PC
  • System info disto/version: Windows 10

Issue:

I am working with multiple installations of WordPress using Laradock. When I visit one site (we'll call it Test1) for the first time, everything looks great. Test2 is an exact clone of Test1, but with a different database and separate file path (/var/www/Test1 & /var/www/Test2). When I try to load Test2, it throws a 500 Error:

Fatal error: Cannot declare class wpai_acf_add_on\acf\fields\FieldGoogleMap, because the name is already in use in /var/www/test1.local/wp-content/plugins/wpai-acf-add-on/libraries/acf-fields/fields/fieldGoogleMap.php on line 0

I've been trying to work around this for a couple of days now. It feels like a misconfiguration with my local environment, so I essentially nuked everything (Fresh Laradock, Reinstalled Docker, wiped all data volumes / networks / images, rebuilt everything, etc) but cannot get around this fatal error.

This feels like somehow the PHP process loading Test2 already has Test1 loaded. Opcache is off and no other object caching is involved, afaik.

Looking for some advice on what to try next as this is causing a headache and I'm out of my own brain power to debug further. I realize there are some specifics that might be necessary that I am leaving out, so ask questions and I can provide further information as best I can. Again, just looking for direction, and if it's some way that I am configuring this thing, maybe it will help someone else down the road. Thanks in advance.


Relevant Code:

Full stacktrace of the error:

Fatal error: Cannot declare class wpai_acf_add_on\acf\fields\FieldGoogleMap, because the name is already in use in /var/www/test1.local/wp-content/plugins/wpai-acf-add-on/libraries/acf-fields/fields/fieldGoogleMap.php on line 0
--
1 | 0.0000 | 404104 | {main}( ) | .../plugins.php:0
2 | 0.3298 | 3210864 | plugin_sandbox_scrape( ) | .../plugins.php:178
3 | 0.3299 | 3213768 | include( '/var/www/test2.local/wp-content/plugins/wpai-acf-add-on/wpai-acf-add-on.php' ) | .../plugin.php:1897
4 | 0.3301 | 3214120 | PMAI_Plugin::getInstance( ) | .../wpai-acf-add-on.php:534
5 | 0.3301 | 3214360 | PMAI_Plugin->__construct( ) | .../wpai-acf-add-on.php:100
6 | 0.4029 | 3360008 | require_once( '/var/www/test2.local/wp-content/plugins/wpai-acf-add-on/libraries/acf-fields/fields/fieldGoogleMapExtended.php' ) | .../wpai-acf-add-on.php:193

Here is the beginning of the class that won't load in separate sites:

<?php

namespace wpai_acf_add_on\acf\fields;

use wpai_acf_add_on\acf\ACFService;

require_once PMAI_ROOT_DIR . '/libraries/acf-fields/base/baseGoogleMap.php';

/**
 * Class FieldGoogleMap
 * @package wpai_acf_add_on\acf\fields
 */
class FieldGoogleMap extends BaseGoogleMap {

...
@yayMark
Copy link

yayMark commented Feb 18, 2019

Did you find a solution to this? I get this when I try to install the WP All Import ACF addon for the first time.

@stale
Copy link

stale bot commented Feb 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale label Feb 2, 2020
@andruxnet
Copy link

I have this problem as well, any solution?

@andruxnet
Copy link

andruxnet commented Feb 5, 2020

Found the solution here: #2392 (comment)

TLDR;
Disable PHP OPCache in your .env file and rebuild. ie PHP_FPM_INSTALL_OPCACHE=false

@stale
Copy link

stale bot commented Feb 26, 2020

Hi again 👋 we would like to inform you that this issue has been automatically closed 🔒 because it had not recent activity during the stale period. We really really appreciate your contributions, and looking forward for more in the future 🎈.

@stale stale bot closed this as completed Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants