Solved

integrating aws (composer installation) with Codeigniter

Posted on 2015-02-17
3
226 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 30

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

AWS has developed and created its highly available global infrastructure allowing users to deploy and manage their estates all across the world through the use of the following geographical components   RegionsAvailability ZonesEdge Locations  Wh…
If you are thinking of adopting cloud services, or just curious as to what ‘the cloud’ can offer then the leader according to Gartner for Infrastructure as a Service (IaaS) is Amazon Web Services (AWS).  When I started using AWS I was completely new…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now