Solved

integrating aws (composer installation) with Codeigniter

Posted on 2015-02-17
3
271 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Microservice architecture adoption brings many advantages, but can add intricacy. Selecting the right orchestration tool is most important for business specific needs.
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

705 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