Solved

integrating aws (composer installation) with Codeigniter

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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 …
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

914 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

19 Experts available now in Live!

Get 1:1 Help Now