Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 758
Reaching-Out Avatar asked Nov 24 '25 18:11

Reaching-Out


1 Answers

There are two main problems are:

1 Composer Autoloading

The AWS dependency needs to be downloaded with Composer, if you want the Composer Autoloader to work correctly. Do not move folders around, when working with Composer. The autoloading expects the files and folders inside the vendor folder.

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

You don't need to do this manually.

2 The use statement is wrong.

Change use Amazon\Aws\ElasticTranscoder\ElasticTranscoderClient;

to use \Aws\ElasticTranscoder\ElasticTranscoderClient;

3 Example Application

Because it is your third question and you seem to have problems with the application structure in connection with Composer, i will provide a simple PHP application template to demonstrate how you work with the AWS dependency.

This example provides a basic namespaced PHP application and includes the Client class from the AWS dependency(, which you have to fetched by Composer).

You find the file over here: https://www.dropbox.com/s/q1b406thgu3146n/php-app-composer-aws.zip?dl=0

Extract the test folder into your www folder. Then execute a composer install and run index.php. You will end up with a error from TranscoderClient, because it expects a configuration. Not part of the problem.

like image 87
Jens A. Koch Avatar answered Nov 26 '25 11:11

Jens A. Koch