-2

收到一个奇怪的错误,我不知道如何解决。这是错误:

( ! ) Catchable fatal error: Argument 2 passed to Guzzle\Service\Client::getCommand() must be an array, string given, called in phar://C:/wamp/www/PHPCodeLance/WebTech/Projects/MIB v2/lib/aws/aws.phar/vendor/guzzle/guzzle/src/Guzzle/Service/Client.php on line 93 and defined in phar://C:/wamp/www/PHPCodeLance/WebTech/Projects/MIB v2/lib/aws/aws.phar/vendor/guzzle/guzzle/src/Guzzle/Service/Client.php on line 113
Call Stack
#   Time    Memory  Function    Location
1   0.0009  676280  {main}( )   ..\test.php:0
2   0.0557  3311632 Aws\Ses\SesClient->send_email( )    ..\test.php:30
3   0.0557  3312128 Aws\Common\Client\AbstractClient->__call( ) ..\test.php:30
4   0.0557  3312208 Guzzle\Service\Client->__call( )    ..(null):103
5   0.0557  3312296 Guzzle\Service\Client->getCommand( )    ..(null):93

这是我使用的代码(直接来自 AWS 页面)

$client = SesClient::factory(array(
    'key'    => '',
    'secret' => '',
    'region' => 'us-east-1'
));

$response = $client->send_email(
    'no-reply@amazon.com', // Source (aka From)
    array('ToAddresses' => array( // Destination (aka To)
        'myemail@hotmail.nl'
    )),
    array( // Message (short form)
        'Subject.Data' => 'Email Test ' . time(),
        'Body.Text.Data' => 'This is a simple test message ' . time()
    )
);

// Success?
var_dump($response->isOK());

更新!!!:

修复了上述问题,现在我遇到了 SSL 证书问题:

Guzzle\Http\Exception\CurlException: [curl] 60: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed [url] https://email.us-east-1.amazonaws.com/ in phar://C:/wamp/www/PHPCodeLance/WebTech/Projects/MIB v2/lib/aws/aws.phar/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php on line 578

提前致谢

4

3 回答 3

1

有关第一个(现在应该已解决 - 如何?)问题的答案,请参阅使用 SES 发送电子邮件时出现 AWS SDK Guzzle 错误

,如果您对某个问题有解决方案,尤其是像这样神秘的问题,请将其发布以供其他人使用。

于 2013-10-13T03:22:50.130 回答
0

SSL 的问题是因为 CURL 不再捆绑 CA 证书,您需要设置正确的 CA 信息。

解决方案 1(更改 PHP.ini):

  1. 从http://curl.haxx.se/docs/caextract.html下载 CA 包 (cacert.pem)
  2. 将它放在您的本地系统上(例如:C:\xampp\cacert.pem)
  3. 打开你的 php.ini
  4. 将 curl.ca_info 选项设置为指向 cacert.pem 的位置

    Example: curl.ca_info="C:\xampp\cacert.pem"
    
  5. 重启阿帕奇

解决方案 2(在每次 CURL 调用之前设置选项)

  1. 从http://curl.haxx.se/docs/caextract.html下载 CA 包 (cacert.pem)
  2. 将它放在您的本地系统上(例如:C:\xampp\cacert.pem)
  3. 编写以下代码:

    curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, TRUE); 
    curl_setopt ($ch, CURLOPT_CAINFO, "pathto\cacert.pem");
    

来源:http ://tumblr.wehavefaces.net/post/52114563111/environment-windows-xampp-curl-library

于 2013-06-04T04:07:40.857 回答
0

First of all, it seems that you should include this code for instantiating the client and sending the email within a try-catch block, that will certainly resolve the Catchable fatal error part and allow your code to continue executing.

As far as the getCommand parameter problem, my guess is that there is some issue with your arguments to send_email() that are passed down the call stack. Without digging through the SDK I don;t know off the top of my head what arguments are specifically passed to getCommand, but you have all the information you need there to debug the issue, as you should be able to map how your arguments are passed through each of the calls shown in the stack trace, debugging along the way to verify what is passed to each function is what is expected.

于 2013-03-29T19:58:05.363 回答