1

Tried to run the elastic transoder php code from et/s/wr.php. wr.php contains the php transcoder code. Here is my code.

<?php
require 'vendor/autoload.php';
use Aws\ElasticTranscoder\ElasticTranscoderClient;
-------------
------------

?>

This is the error when I'm running from the loaclhost.

Fatal error: Class 'Aws\ElasticTranscoder\ElasticTranscoderClient' not found in C:\wamp\www\sep24\et\s\wr.php on line 5

So what should be done.. ? Need Help.. and yes i have included the AWS folder which i downloaded from GIT.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Reaching-Out
  • 415
  • 6
  • 26

2 Answers2

0

Try below code

<?php
require_once("path_to_ElasticTranscoderClient_file");
use Aws\ElasticTranscoder\ElasticTranscoderClient; 
$elasticTranscoder = ElasticTranscoderClient::factory(array(
.....
.....
?>

or user composer to autoload this file.

Sumit Patil
  • 556
  • 1
  • 5
  • 19
  • Now I'm getting the error like this. {Fatal error: Class 'Aws\AwsClient' not found in C:\wamp\www\sep24\et\Aws\ElasticTranscoder\ElasticTranscoderClient.php on line 10} – Reaching-Out Sep 24 '15 at 07:12
  • Have you put `Aws` folder properly. It should be at root of `et` folder – Sumit Patil Sep 24 '15 at 07:15
  • if i remove the .php from the require_once. I'm getting error like this...{Fatal error: require_once(): Failed opening required 'Aws\ElasticTranscoder\ElasticTranscoderClient' (include_path='.;C:\php\pear') in C:\wamp\www\sep24\et\wr.php on line 3} And yes i have included it properly – Reaching-Out Sep 24 '15 at 07:15
  • Can you take a look at this-> http://stackoverflow.com/questions/32775389/fatal-error-require-failed-opening-required-c-wamp-www-sep24-e-src-functio – Reaching-Out Sep 25 '15 at 07:27
0

If you fetch the package via Composer, then you will find

  • (a) your package in the vendor folder (vendor\aws\aws-sdk-php\src\ElasticTranscoder) and
  • (b) an autoloading file at the top level of the vendor folder, named autoload.php.

You need to load this file. This enables the Composer Autoloader for all classes installed by it.

<?php
require 'vendor/autoload.php';

Or with your code:

<?php
require 'vendor/autoload.php';

use Aws\ElasticTranscoder\ElasticTranscoderClient;

$elasticTranscoder = ElasticTranscoderClient::factory($options);

Maybe the folder is wrong. Let's define the root folder and require the autoloader based on that:

define('ROOT', dirname(__FILE__));
require ROOT . '/vendor/autoload.php';

Its a simply include path issue.

Jens A. Koch
  • 39,862
  • 13
  • 113
  • 141
  • I did that . But still getting the same error. I'll edit the question too. – Reaching-Out Sep 24 '15 at 14:11
  • It could be `../vendor/autoload.php`, because you are in `et/s`. So its one level up and then down to the vendor folder. – Jens A. Koch Sep 24 '15 at 14:17
  • didn't solve the issue but instead of using composer I included aws-autoloader.php. It solved that error. Third method in AWS PHP SDK. It created another error.. :-) But thank You though. for looking into it. Will post the error if I couldn't find any solution. – Reaching-Out Sep 24 '15 at 14:22
  • Installation manual is always a good lecture :D Glad you solved it. – Jens A. Koch Sep 24 '15 at 14:24
  • Can you take a look at this-> http://stackoverflow.com/questions/32775389/fatal-error-require-failed-opening-required-c-wamp-www-sep24-e-src-functio – Reaching-Out Sep 25 '15 at 07:27