Fatal error on missing require (with solution)
-
I had a fatal error on the first installation of the plugin, the error was:
PHP Fatal error:Uncaught Error: Failed opening required '/wordpress/core/6.1.1/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-settings.php' (include_path='/:.') in /srv/htdocs/wp-content/plugins/mail-boxes-etc/lib/Helper/Data.php:171
We’re using Pressable hosting that has a global copy of the wordpress root, same for all customers. Plugins, on the other hand, are saved in a user-dedicated area, which is not relative to the wordpress root. You should use the specific constant
WP_PLUGIN_DIR
to retrieve the plugins directory in a safer way, so the line mentioned in the error should be as follow:require_once(WP_PLUGIN_DIR.'/woocommerce/includes/admin/class-wc-admin-settings.php');
This will solve the issue and work regardless of the server layout of the user.
- The topic ‘Fatal error on missing require (with solution)’ is closed to new replies.