client-cli icon indicating copy to clipboard operation
client-cli copied to clipboard

Error: Class `WPAPI` not found...

Open domenic95 opened this issue 11 years ago • 3 comments

I am getting an error when running this command:

wp --require=client.php api oauth1 connect http://example.com --key=4ugulKVfFNka --secret=ozGESz8v4FNdmpoCfPw9gNqk9qbc29IAMujaaSPxapAduiml

PHP Fatal error: Class 'WPAPI' not found in /home/dschiera/wp-cli/client-cli/lib/commands/base.php on line 29

I am using a different url of course. The Wordpress installation I'm posting to has JSON REST API and OAuth Server Plugins installed. I was able to authenticate. I used composer install, and composer update. I'm running PHP 5.5.10.

domenic95 avatar Aug 14 '14 20:08 domenic95

Having overcome the problem in issue #18 I also suffered this PHP Fatal Error when performing "wp api user list".

My workaround was to add the following code to the start of client-cli/client.php

use WPAPI;
require_once __DIR__ . '/vendor/wp-api/client/library/WPAPI.php' ;
WPAPI::register_autoloader();

bobbingwide avatar Oct 13 '14 19:10 bobbingwide

thanks bobbingwide, great job!

Giambapisasale avatar Mar 10 '15 08:03 Giambapisasale

Thanks @bobbingwide

cehwitham avatar Jun 18 '15 09:06 cehwitham