Support Forum
So I tried to run the composer update command to update meta box and other dependencies.
I ran the command an Meta Box was updated from 5.6.8 to 5.6.14. This now causes the following issue:
Fatal error: Uncaught Error: Failed opening required '/xxx/meta-box/vendor/autoload.php'
Failed to open stream: No such file or directory in /xxx/meta-box/inc/loader.php on line 63
So Meta Box is searching for the "autoload.php" in the "/vendor" directory which can't be found because there is no such directory. Is this already a known issue?
Support on this would be much appreciated, thanks!
Hello,
Please try to run composer install
in the meta box plugin folder to fix this issue. Let me know how it goes.
Hello Peter,
thanks for your reply. sadly this did not solve the issue. I'm still getting the fatal error. I'll attach the full error here:
Warning: require(/homepages/15/d.../wp-content/mu-plugins/meta-box/vendor/autoload.php): Failed to open stream: No such file or directory in /homepages/15/d.../wp-content/mu-plugins/meta-box/inc/loader.php on line 63
Fatal error: Uncaught Error: Failed opening required '/homepages/15/d.../wp-content/mu-plugins/meta-box/vendor/autoload.php' (include_path='.:/usr/lib/php8.1') in /homepages/15/d.../wp-content/mu-plugins/meta-box/inc/loader.php:63
Stack trace:
#0 /homepages/15/d.../wp-content/mu-plugins/meta-box/meta-box.php(19): RWMB_Loader->init()
#1 /homepages/15/d.../wp-content/mu-plugins/mu-plugin-loader.php(18): require_once('/homepages/15/d...')
#2 /homepages/15/d.../wp-includes/class-wp-hook.php(308): DotsUnited\MuPluginLoader\{closure}('')
#3 /homepages/15/d.../wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#4 /homepages/15/d.../wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#5 /homepages/15/d.../wp-settings.php(412): do_action('muplugins_loade...')
#6 /homepages/15/d.../wp-config.php(116): require_once('/homepages/15/d...')
#7 /homepages/15/d.../wp-load.php(50): require_once('/homepages/15/d...')
#8 /homepages/15/d.../wp-blog-header.php(13): require_once('/homepages/15/d...')
#9 /homepages/15/d.../index.php(17): require('/homepages/15/d...')
#10 {main} thrown in /homepages/15/d.../wp-content/mu-plugins/meta-box/inc/loader.php on line 63
Hello,
Did you go to the folder "/homepages/15/d.../wp-content/mu-plugins/meta-box" and run the command composer install
? The file vendor/autoload.php
will be generated after running the command.
If it still does not work, you can download the plugin Meta Box from WordPress.org and replace it with the meta box folder on your hosting.
https://wordpress.org/plugins/meta-box/
Hello Peter,
in our WordPress projects we are basically using a composer.json
in the project's root directory to install plugins.
A simplified version looks like this:
{
"config": {
"allow-plugins": {
"composer/installers": true
}
},
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
}
],
"require": {
"composer/installers": "^1.4",
"wpmetabox/meta-box": "5.6.14"
},
"extra": {
"installer-paths": {
"public/plugins/{$name}/": [
"type:wordpress-plugin",
"type:wordpress-muplugin"
],
"public/themes/{$name}/": [
"type:wordpress-theme"
]
},
"wordpress-install-dir": "public"
}
}
This results in the wpmetabox/meta-box
package being installed to ./public/plugins/meta-box
. There is no ./public/plugins/meta-box/vendor
folder, which seems to match the contents of the repository at https://github.com/wpmetabox/meta-box/tree/5.6.14
We would prefer to stick to this workflow using Composer instead of manually updating plugins or switching to the archives found on https://wordpress.org/plugins/meta-box/
Maybe this behavior is caused by the entries in .distignore
or some missing hook for the Composer WordPress installer.
Hi,
I've just fixed it. Can you please try this fix? I'll release new version for Meta Box soon when it's confirmed.
Hello!
Thanks for the fix you've provided. I've implemented it and now the error message changed to this:
Fatal error: Uncaught Error: Class "MetaBox\Updater\Option" not found in /homepages/15/d.../wp-content/mu-plugins/meta-box/inc/loader.php:103
Stack trace:
#0 /homepages/15/d.../wp-content/mu-plugins/meta-box/meta-box.php(19): RWMB_Loader->init()
#1 /homepages/15/d.../wp-content/mu-plugins/mu-plugin-loader.php(18): require_once('/homepages/15/d...')
#2 /homepages/15/d.../wp-includes/class-wp-hook.php(308): DotsUnited\MuPluginLoader\{closure}('')
#3 /homepages/15/d.../wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#4 /homepages/15/d.../wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#5 /homepages/15/d.../wp-settings.php(412): do_action('muplugins_loade...')
#6 /homepages/15/d.../wp-config.php(116): require_once('/homepages/15/d...')
#7 /homepages/15/d.../wp-load.php(50): require_once('/homepages/15/d...')
#8 /homepages/15/d.../wp-blog-header.php(13): require_once('/homepages/15/d...')
#9 /homepages/15/d.../index.php(17): require('/homepages/15/d...')
#10 {main} thrown in /homepages/15/d.../wp-content/mu-plugins/meta-box/inc/loader.php on line 103
So that did not completely fix the problem.
Looks like when you use Composer, after installing packages, you don't include the Composer's autoload.php
file.
There are 2 workarounds for this case:
1. In your code, just add this line somewhere:
require 'path/to/vendor/autoload.php';
(Note that this is the vendor/autoload.php
generated by Composer, it's in the root folder. It's not the vendor
folder in Meta Box).
This way, when you install anything with Composer (maybe a common PHP lib), autoload will works for all packages, not just Meta Box.
2. Or replace Meta Box's Composer package wpmetabox/meta-box
with WP Packagist. Using this method, you'll pull all the content from wordpress.org/plugins/meta-box/ into your code, and thus - will contain full vendor
folder. And you don't have to modify your code.