Solved

integrating aws (composer installation) with Codeigniter

Posted on 2015-02-17
3
256 Views
Last Modified: 2015-03-17
Hello,
I'm using Codeigniter 2.1

Inside index.php I added:

 
 require $application_folder .'/vendor/autoload.php'; 

Open in new window


aws is isntalled in application/vendor directory  Screen-Shot-2015-02-17-at-10.09.17-PM.pn
inside my Controller , I am trying to put a file inside a bucket:

 
             
  
     $s3= Aws\S3\S3Client::factory([
       
           'key' => 'SK2AILHWLV6CO7H3BE4L',
           'secret' => 'LtBvZWW/T//79HcGbA129e658VtlkPRxxQNqpKoMysz',
           'bucket' => 'zzz'
       
       ]);
       
       
       $result = $s3->putObject(array(
           'Key' => 'Files2',
           'Bucket' => 'zzz',
           'SourceFile'   => 'start.csv',
           'ContentType'  => 'text/plain',
           'ACL'          => 'public-read',
           'StorageClass' => 'REDUCED_REDUNDANCY',
           'Metadata'     => array(
               'param1' => 'value 1',
               'param2' => 'value 2'
           )
       ));
       
       echo $result['ObjectURL'];

Open in new window





but I'm getting an error:

Fatal error: Class 'Aws\S3\S3Client' not found in /www/server/application/controllers/testComp.php on line 34

Open in new window



To integrate Composer with Codeigniter I folllowed the instuctions :  http //philsturgeon.uk/blog/2012/05/composer-with-codeigniter/
0
Comment
Question by:sniger
  • 2
3 Comments
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 40615978
First, try to replace this:
 require $application_folder .'/vendor/autoload.php'; 

Open in new window

with this:
 require base_url('vendor/autoload.php'); 

Open in new window

Second, are you sure this is correct?
$s3= Aws\S3\S3Client::factory([

Open in new window

I think if the class is correctly installed and loaded, it should be available this way:
$s3= S3Client::factory([

Open in new window

0
 

Accepted Solution

by:
sniger earned 0 total points
ID: 40618580
Sorry, it did not work
0
 

Author Closing Comment

by:sniger
ID: 40670010
did not work
0

Featured Post

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AWS Glacier is Amazons cheapest storage option and is their answer to a ‘Cold’ storage service.  Customers primarily use this service for archival purposes and storage of infrastructure backups.  Its unlimited storage potential and low storage cost …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question