Fatal error: Uncaught Error: Class 'wpdb' not found in phar

Hi Team,

I am trying to create custom plugin to use Algolia with Wordpress i.e. algolia custom integration plugin as per Building Search UI | WordPress | Algolia . I am using window and installed wp-cli and able to check wordpress version etc using WP CLI commands, but when I am running “wp algolia reindex_post” command getting “Fatal error: Uncaught Error: Class ‘wpdb’ not found in phar://D:/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1277) : eval()'d code:101” error.
Please help me to fix the issue

Thank you in advance

That seems like a pathing issue or version problem with WP/the CLI. What version of PHP are you running on Windows? Is it a Cygwin version or one you installed yourself?

Hi Chuck,
Thank you for your response. I am using following versions on windows

  1. PHP 7.4.26
  2. WP 5.9
  3. WP-CLI 2.6.0
    I didn’t use Cygwin. I installed WP CLI by following this article Installing WP-CLI in Windows - WEN Solutions and set WP CLI path https://i.imgur.com/tHEp5K4.png
    Thank you