Search code examples
phpamazon-web-servicesamazon-elastic-transcoder

Fatal error: require(): Failed opening required 'C:\wamp\www\sep24\e/src/functions.php' (include_path='.;C:\php\pear')


Tried to run the trans.php program from wamp server from the path

C:\wamp\www\sep24\e\trans.php

I have included the AWS folder in

C:\wamp\www\sep24\e\Amazon\

And AWS credential file in wamp/www folder as well user directory for the access

C:\wamp\www\.aws\credentials & C:\Users\username\.aws\credentials

This is my program

<?php
 define('ROOT', dirname(__FILE__));
 require ROOT . '/vendor/autoload.php';
 use Amazon\Aws\ElasticTranscoder\ElasticTranscoderClient;

  -------------
  ------------

   // no error here.
  ?>

When i'm trying to run the program, I get this error

Fatal error: require(): Failed opening required 'C:\wamp\www\sep24\e/src/functions.php' (include_path='.;C:\php\pear') in C:\wamp\www\sep24\e\vendor\composer\autoload_real.php on line 54

I have included all the packages of AWS which I downloaded from the git.

What change should I make ?


Solution

  • Use composer.

    Create testaws directory and put composer.json file with content below (you can adjust it to your needs for example PHP version or dev packages)

    {
        "name": "yourname/sampleapp",
        "description": "Sample app",
        "require": {
            "php": ">=5.5.0",
            "aws/aws-sdk-php" :  "dev-master"
        },
    }
    

    run composer install

    then in index.php in testaws directory put this line in index.php

    require __DIR__ . '/vendor/autoload.php';

    After you do this steps it should work. More about composer you will find there

    Also you can find sample project here