出现以下错误:
PHP警告:require(Guzzle/Http/Client.php):打开流失败
第7行/var/www/html/index.php中没有这样的文件或目录PHP Fatal error: require(): Failed open 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第7行
我的代码<?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';
谁能回答这个问题?
谢谢Ashok
这个自动加载/包含逻辑看起来一点都不对。如果您通过PEAR安装了SDK和Guzzle,那么PEAR目录不应该已经在PHP路径中了吗?如果是,你只需要做:
require 'AWSSDKforPHP/aws.phar';
在此之后,所有AWS或Guzzle类都应该是可自动加载的。参见:http://docs.aws.amazon.com/aws-sdk-php/guide/latest/quick-start.html