简体   繁体   中英

Fatal error: Class 'OpenCloud\Rackspace' not found

For a custom application, I am trying to integrate Rackspace cloud files using php-opencloud library.

This is the link I followed for setup - https://github.com/srijanaravali/php-opencloud/blob/master/docs/getting-started.md

# Install Composer
curl -sS https://getcomposer.org/installer | php

# Require php-opencloud as a dependency
php composer.phar require rackspace/php-opencloud:dev-master

However, when I try to instantiate a client object, it throws an error:

Fatal error: Class 'OpenCloud\Rackspace' not found in /var/www/example/Project/sites/all/libraries/php-opencloud/test.php on line 7

Here is the code snippet:

<?php

require 'vendor/autoload.php';
use OpenCloud\Rackspace;

// 1. Instantiate a Rackspace client.
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
    'username' => getenv('Axxxxxxx'),
    'apiKey'   => getenv('abcxxxxxxxxxxxxxxxxxxxx')
));

print_r($client); die('!!');

Any pointers about whats missing?

Got it working. For some strange reason, php-opencloud library was empty under vendors/rackspace/php-opencloud .

Cloned one from github and created a symlink to it from above directory. It is working fine now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM