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

PHP Fatal error: Cannot redeclare LkWdwrd\MuPluginLoader\Util\rel_path() #113

Open
alapiere opened this issue Jul 2, 2023 · 2 comments
Open

Comments

@alapiere
Copy link

alapiere commented Jul 2, 2023

Hi,
I've got an error in logs and in specific custom BO page;

Not sure what caused this.

PHP Fatal error: Cannot redeclare LkWdwrd\MuPluginLoader\Util\rel_path() (previously declared in /www/XX/public/vendor/boxuk/wp-muplugin-loader/src/Util/util.php:23) in /www/XX/public/vendor/boxuk/wp-muplugin-loader/src/Util/util.php on line 23"

  "require": {
     (..)
    "boxuk/wp-muplugin-loader": "*",

 "config": {
  "require-all": true,
    "allow-plugins": {
      (..)
      "boxuk/wp-muplugin-loader": true
    }

if I remove mu-require.php from mu-plugins, it works fine.
Happy to provide any additional troubleshooting instructions if needed

@jdamner
Copy link

jdamner commented Aug 3, 2023

Hey @alapiere

Do you have any other mu-plugin loader packages in your composer.json file? And would it be possible you're loading the muplugin-loader twice?

@asengerdmk
Copy link

asengerdmk commented Oct 13, 2023

@jdamner
Getting the same issue.

error message

PHP Fatal error:  Cannot redeclare LkWdwrd\MuPluginLoader\Util\rel_path() (previously declared in /var/www/html/vendor/boxuk/wp-muplugin-loader/src/Util/util.php:23) in /var/www/html/vendor/boxuk/wp-muplugin-loader/src/Util/util.php on line 23

composer.json

    "require": {
        "composer/installers": "^2.2",
        "johnpbloch/wordpress-core": "6.3.2",
        "wpackagist-plugin/wp-fastest-cache": "^1.2"
    },
    "extra": {
        "force-mu": [
            "wp-fastest-cache"
        ],
     }

Maybe it's because we require the utils here for composer: https://github.com/boxuk/wp-muplugin-loader/blob/master/src/Composer/MuLoaderPlugin.php#L32
And another time when the generated file /wp-content/mu-plugins/mu-require.php calls this file: https://github.com/boxuk/wp-muplugin-loader/blob/master/src/mu-loader.php#L28

After commenting out the latter it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants