[英]Issue in AWS S3 PHP SDK Guzzle
出現以下錯誤:
PHP警告:require(Guzzle / Http / Client.php):無法打開流:在第7行的/var/www/html/index.php中沒有此類文件或目錄
PHP致命錯誤:require():無法打開所需的'Guzzle / Http / Client.php'(include_path ='。:/ usr / share / pear:/ usr / share / php:/ home / ec2-user / pear:/第7行的/var/www/html/index.php中的home / ec2-user / pear / share / pear / Guzzle:./ Aws')
我的代碼
<?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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.