Hi - I’ve tried installing the auth0 plugin version 5.2.0 using Composer. When trying to activate the plugin, I receive a fatal error, 'Error: Class “Auth0\WordPress\Plugin” not found in [REDACTED]/wp-content/plugins/wordpress/wpAuth0.php. Is this a known issue or did I install it incorrectly?
Hi @markramos83
There’s no such known issue — could you step me through your install process?
The error indicates that your Composer installation isn’t able to autoload the namespace, which sounds like a configuration issue with the host/site setup.
Thanks evansims; I’m brand new to using Composer for installing plugins so I figured it was user error. I initialized Composer, and after adding the composer/installers package, I ran this command:
composer require symfony/http-client nyholm/psr7 auth0/wordpress:^5.0
My composer.json file now contains:
"require": {
"composer/installers": "~1.0",
"symfony/http-client": "^7.0",
"nyholm/psr7": "^1.8",
"auth0/wordpress": "^5.0"
},
And the plugin is now visible in my WP dashboard. But when I click to Activate it, I get that fatal error.
No worries @markramos83, we’ll get ya up and running!
Some essentials, just to cover our bases:
- What type of WordPress install do you have? Standard (or Multisite?), or are you using a variant like Bedrock?
- What version of PHP, Composer, and WordPress are you running?
In regards to your install steps:
- Where did you run the
composer require
command? Depending on your install type, this might need to be adjusted. - Can you check inside your
/wp-content/plugins/wordpress
folder and let me know if there is a ‘vendor’ subfolder in there?
- Standard, not using any variant or Bedrock.
- PHP 8.2, Composer 2.7.6, WordPress 6.5.3
- I ran this from the wp-content/plugins folder
- There is not a vendor subfolder here. Upon install, a vendor folder was added to /wp-content/plugins/
As an aside, I found this thread which seems to be very similar to my issue: Composer installation not working - fatal error upon attempting activation · Issue #893 · auth0/wordpress · GitHub
Interesting, OK — re: 4, is there a composer.json
file in there? If so, can you try cd
ing into that folder and running composer install
from there? That should create a vendor
subfolder with the necessary dependencies and, critically, the autoloader that’s missing that is likely the root of the issue for you. Let me know how that goes
Success! I had to also remove the ‘vendor’ line from /wp-content/plugins/wordpress/.gitignore so that I could push these changes to my host. But now that all dependencies and autoloader have been added, I’m able to activate and get on with configuration. Please let me know if there’s anything else I may be missing, otherwise thanks very much for your help!
Fantastic! So glad that sorted things for you. It sounds like you did everything just as you should’ve, so I’ll dig in and see if I can figure out what might have gone wrong there — at a minimum, I want to make sure our documentation covers all the edge cases possible so we can save others from similar situations, and if there’s a bug somewhere, definitely want to fix that. I appreciate you stepping through it with me!
Please do let us know if you hit any other snags, and we’ll be happy to help.
I ran into a similar error.
-
Hosing is provided by WP Engine, its a standard structure of WordPress.
-
PHP 8.2 and WordPress 6.8.2.
-
Ran the command
composer require symfony/http-client nyholm/psr7 auth0/wordpress:^5.0
from thewp-content/plugins
folder, and avendor
folder was created there. Nowp-content/plugins/wordpress
folder was created.
After reading a few closed issues on the github repo, and a few issues posted in these forums, I tried these next set of steps to get it installed. After deleting the vendor folder, composer.json, and composer.lock files created from above, I started fresh.
- Download the latest
Source code.zip
file available from the repo’s releases: Releases · auth0/wordpress · GitHub - Upload and manually install that .zip file to the WordPress plugin dashboard.
cd
into/wp-content/plugins/wordpress-5.3.0/
- Ran
composer install
in this directory, as suggested from your fix in this post above. - Return to the WordPress plugin dashboard and activate.
Success! This got the plugin installed and activated for me.