Reputation: 1
Getting following error:
PHP Warning: require(Guzzle/Http/Client.php): failed to open stream: No such file or directory in /var/www/html/index.php on line 7
PHP Fatal error: require(): Failed opening required 'Guzzle/Http/Client.php' (include_path='.:/usr/share/pear:/usr/share/php:/home/ec2-user/pear:/home/ec2-user/pear/share/pear/Guzzle:./Aws') in /var/www/html/index.php on line 7
my code
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . '/home/ec2-user/pear');
set_include_path(get_include_path() . PATH_SEPARATOR . '/home/ec2-user/pear/share/pear/Guzzle');
set_include_path(get_include_path() . PATH_SEPARATOR . './Aws');
function my_autoload($class_name)
{
$class_name = str_replace("\\","/",$class_name);
require $class_name. '.php';
}
spl_autoload_register('my_autoload');
require '/home/ec2-user/pear/share/pear/Guzzle/Service/Client.php';
require 'Aws/S3/S3Client.php';
Can someone answer this?
Thanks Ashok
Upvotes: 0
Views: 1671
Reputation: 6527
This autoloading/including logic doesn't look right at all. If you installed the SDK and Guzzle through PEAR, shouldn't the PEAR directory already be in your PHP path? If so, you only need do:
require 'AWSSDKforPHP/aws.phar';
All of the AWS or Guzzle classes should be autoload-able after that. Also see: http://docs.aws.amazon.com/aws-sdk-php/guide/latest/quick-start.html
Upvotes: 0