我正在尝试使用< code>Amazon SDK for php,从运行< code>AppServ 2.5.10(包括< code>Apache 2.2.8 、< code>php 5.2.6 、< code>mysql 5.0.51b和< code>phpMyAdmin 2.10.3)的(localhost) Windows 8机器上连接亚马逊的S3文件。
为了兼容< code>Amazon SDK的命名空间特性,我用版本< code>5.3.28替换了php,方法是下载它的压缩文件并解压缩。
我的php代码可以很好地访问< code>Amazon EC2中的< code>S3文件,但是在我的Windows本地主机中失败了。
但是,当我在Windows本地主机中运行php srpse t读取Amazon S3
桶文件时,我得到了SSL错误如下:
致命错误:C:\ AppServ \ www \ ecity \ vendor \ Guzzle \ Guzzle \ src \ Guzzle \ Http \ Curl 60:SSL证书问题:无法获取本地颁发者证书[URL]https://images-ST . S3 . amazonaws . com/us/123977 _ sale _ red _ car . png ' C:\ AppServ \ www \ ecity \ vendor \ Guzzle \ Guzzle \ src \ Guzzle \ Http \ Curl \ Curl multi . PHP:342堆栈跟踪:
#0 C:\AppServ\www\ecity\vendor\guzzle\guzzles\src\guzzly\Http\Curl\CurlMulti。php(283):Guzzle\Http\Curl\CurlMulti-
#1 C:\AppServ\www\ecity\vendor\guzzle\guzzle\src\Guzzle\http\curl\curlmulti.php(248): Guzzle\http\curl\curlmulti-
# 2c:\ AppServ \ www \ ecity \ vendor \ Guzzle \ Guzzle \ src \ Guzzle \ Http \ Curl \ Curl multi . PHP(231):Guzzle \ Http \ Curl \ Curl multi-
# 3c:\ AppServ \ www \ ecity \ vendor \ Guzzle \ Guzzle \ src \ Guzzle \ Http \ Curl \ Curl multi . PHP(215):Guzzle \ Http \ Curl \ Curl multi-
#4 C:\AppServ\www\ecity\ven in C:\AppServ\www\ecity\Provier\aws\aws-sdk-php\src\Aws\Common\Client\AbstractClient.php在线288
我从http://curl.haxx.se/ca/cacert.pem并在php中定义它。ini如下所示:
curl.cainfo = "C:\AppServ\cacert.pem"
但是我仍然得到了同样的错误。似乎php不尊重curl.cainfo
中定义的php.ini
。
我的php版本是5.3.28
,根据localhost/phpinfo.php
。
我还检查了 cainfo
参数是否正确为 C:\AppServ\cacert.pem
使用
echo ini_get( "curl.cainfo" ) ;
在php脚本中。
PHP版本高于5.3
应支持curl.cainfo
中的php.ini
。
在Windows的命令行中,我检查了curl行为,它似乎工作正常。
C:\Users\Jordan>curl https://s3-us-west-2.amazonaws.com/images-st/aaa.txt
curl: (60) SSL certificate problem: unable to get local issuer certificate
......
C:\Users\Jordan>curl --cacert C:\AppServ\cacert.crt https://s3-us-west-2.amazonaws.com/images-st/aaa.txt
This is aaa.txt file.
Stored in Amazon S3 bucket.
是不是因为我在Windows中使用了Apache,它与我下载的php5.3.28
zip文件不匹配http://windows.php.net/download/VC9 x86线程安全(2014-6-11 01:09:56)zip版本。
在我的apache的httpd ssl中。在conf文件中,即使在Windows8中从本地主机使用,我也有以下设置。
<VirtualHost _default_:443>
DocumentRoot "C:/AppServ/www"
ServerName localhost:443
ServerAdmin webmaster@localhost.com
ErrorLog "C:/AppServ/Apache2.2/logs/error.log"
TransferLog "C:/AppServ/Apache2.2/logs/access.log"
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile "C:/AppServ/Apache2.2/conf/mydomain.cert"
SSLCertificateKeyFile "C:/AppServ/Apache2.2/conf/mydomain.key"
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "C:/Apache2.2/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
BrowserMatch ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog "C:/AppServ/Apache2.2/logs/ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>
现在我想知道是什么问题,以及如何连接到< code >亚马逊S3桶文件和< code>RDS数据库,而不产生这些< code>curl无法从我的Windows 8本地主机获取本地发行者证书的问题。
有什么建议吗?
我得到了同样的错误,如果你想使用http,那么你可以使用下面的解决方案:
Error executing "PutObject" on "https://s3-ap-southeast-2.amazonaws.com/mybucketname/TestBanner1_e1d8d74e41"; AWS HTTP error: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
我已经使用http方法解决了这个问题。在php.ini文件中使用安全方式enter _ curl . cainfo = "/path/to/file . cacert . PEM " _是不安全的:
解决方案:
'options' => [
'scheme' => 'http',
],
完整的示例代码:
// ...
's3bucket' => [
'class' => \frostealth\yii2\aws\s3\Storage::className(),
'region' => 'ap-southeast-2',
'credentials' => [ // Aws\Credentials\CredentialsInterface|array|callable
'key' => 'JGUTEHCDE.............OSHS',
'secret' => 'SJEUC-----------jzy1-----rrT',
],
'bucket' => 'yours3bucket',
//'cdnHostname' => 'http://example.cloudfront.net',
'defaultAcl' => \frostealth\yii2\aws\s3\Storage::ACL_PUBLIC_READ,
'debug' => false, // bool|array
'options' => [
'scheme' => 'http',
],
],
// ...
对于使用WampServer的用户,打开< code>php.ini文件,然后向下滚动到底部并添加以下内容:
curl.cainfo = “C:\wamp\bin\php\php7.2.3\cacert.pem”
确保您在当前使用的php版本的文件夹中有cacert.pem
文件。在我的情况下,我把它放在php7.2.3
文件夹中。
正如Jeremy Lindblom在评论中提到的,AWS SDK v2的解决方案是设置<code>ssl。certificate_authority选项在实例化SDK时:
$aws = Aws\Common\Aws::factory(array(
'region' => 'us-west-2',
'ssl.certificate_authority' => '/path/to/updated/cacert.pem'
));
http://docs.aws.amazon.com/aws-sdk-php/guide/latest/faq.html#what-do-i-do-about-a-curl-ssl-certificate-error
我要补充一点,这在 AWS 开发工具包 v3 中已更改,下面是新方法:
$client = new DynamoDbClient([
'region' => 'us-west-2',
'version' => 'latest',
'http' => [
'verify' => '/path/to/my/cert.pem'
]
]);
http://docs.aws.amazon.com/aws-sdk-php/v3/guide/guide/configuration.html#verify
问题内容: 我在本地开发环境上使用WAMP,并尝试从信用卡中扣款,但收到错误消息: cURL错误60:SSL证书问题:无法获取本地颁发者证书 我在Google上进行了很多搜索,很多人建议我下载此文件:cacert.pem,将其放在某个位置,然后在php.ini中引用它。这是我的php.ini中的部分: 但是,即使多次重新启动服务器并更改了路径后,我仍然收到相同的错误消息。 我使用来自Apache模
我在Google上搜索了很多,很多人建议我下载这个文件:cacert.pem,把它放在某个地方,并在我的php.ini中引用它。这是我的php.ini中的部分: 然而,即使在重新启动服务器几次并更改路径后,我也会得到相同的错误消息。 我使用Apache模块中的WAMP并启用ssl_module。在PGP扩展中,我启用了php_curl。 这是我正在运行的代码:
我使用MAMP作为本地开发环境。我想实现一个谷歌认证-但不断得到这个SSL错误。 < li >正如其他SO主题所建议的,我已经在我的PHP.ini文件中添加了这行代码: 知道如何在我的本地环境中传递这个SSL错误吗? 这是代码:
我有一个站点在本地运行在MAMP Pro(macos)上,当我使用时,它总是出现cURL错误 我已经搜索并尝试了多种解决方案,但似乎没有任何效果。 null