title: AWS SSL security error : [curl] 60: SSL certificate prob...: unable to get local issuer certificate
body: <p>I am trying to connect Amazon's S3 files from my (localhost) Windows 8 machine running <code>AppServ 2.5.10</code> (which includes <code>Apache 2.2.8</code>, <code>php 5.2.6</code>, <code>mysql 5.0.51b</code> and <code>phpMyAdmin 2.10.3</code>) using <code>Amazon SDK</code> for php. </p>
  
  <p>In order to be compatible with <code>Amazon SDK's</code> namespace feature, I replaced php with version <code>5.3.28</code> by downloading its zipped file and unzipped it.  </p>
  
  <p>My php code works fine to access <code>S3</code> file in <code>Amazon EC2</code> but it failed in my Windows local host.</p>
  
  <p>However when I run the php srcipt to read <code>Amazon S3</code> bucket file in Windows local host machine, I got SSL error as following: </p>
  
  <blockquote>
    <p>Fatal error: Uncaught exception 'Guzzle\Http\Exception\CurlException'
    with message '[curl] 60: SSL certificate problem: unable to get local
    issuer certificate [url]
    <a href="https://images-st.s3.amazonaws.com/us/123977_sale_red_car.png" rel="noreferrer">https://images-st.s3.amazonaws.com/us/123977_sale_red_car.png</a>' in
    C:\AppServ\www\ecity\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php:342
    Stack trace: </p>
    
    <p>#0
    C:\AppServ\www\ecity\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php(283):
    Guzzle\Http\Curl\CurlMulti->isCurlException(Object(Guzzle\Http\Message\Request),
    Object(Guzzle\Http\Curl\CurlHandle), Array) </p>
    
    <p>#1
    C:\AppServ\www\ecity\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php(248):
    Guzzle\Http\Curl\CurlMulti->processResponse(Object(Guzzle\Http\Message\Request),
    Object(Guzzle\Http\Curl\CurlHandle), Array) </p>
    
    <p>#2
    C:\AppServ\www\ecity\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php(231):
    Guzzle\Http\Curl\CurlMulti->processMessages() </p>
    
    <p>#3
    C:\AppServ\www\ecity\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php(215):
    Guzzle\Http\Curl\CurlMulti->executeHandles() </p>
    
    <p>#4
    C:\AppServ\www\ecity\ven in
    C:\AppServ\www\ecity\vendor\aws\aws-sdk-php\src\Aws\Common\Client\AbstractClient.php
    on line 288</p>
  </blockquote>
  
  <p>I download the certifate from <a href="http://curl.haxx.se/ca/cacert.pem" rel="noreferrer">http://curl.haxx.se/ca/cacert.pem</a> and  define it in php.ini as following: </p>
  
  <pre><code>curl.cainfo = "C:\AppServ\cacert.pem"
  </code></pre>
  
  <p>but I still got the same error. It seems php doesn't honor the <code>curl.cainfo</code> defined in <code>php.ini</code>. </p>
  
  <p>My php version is <code>5.3.28</code> according to <code>localhost/phpinfo.php</code>. </p>
  
  <p>I also checked the <code>cainfo</code> parameter to be correct as <code>C:\AppServ\cacert.pem</code>  using </p>
  
  <pre><code>echo ini_get( "curl.cainfo" ) ; 
  </code></pre>
  
  <p>in the php script. </p>
  
  <p>Php version higher than <code>5.3</code> shall support <code>curl.cainfo</code> in <code>php.ini</code>.</p>
  
  <p>In Windows' command line, I check curl behavior and it seems work fine. </p>
  
  <pre><code>C:\Users\Jordan&gt;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&gt;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.
  </code></pre>
  
  <p>Is it because I used Apache in Windows which doesn't match php <code>5.3.28</code> zip file I downloaded from <a href="http://windows.php.net/download/" rel="noreferrer">http://windows.php.net/download/</a> VC9 x86 Thread Safe (2014-Jun-11 01:09:56) zip version. </p>
  
  <p>In my apache's  httpd-ssl.conf file, I have the following setting even I use from local host in Windows 8. </p>
  
  <pre><code>&lt;VirtualHost _default_:443&gt;
  
  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"
  
  &lt;FilesMatch "\.(cgi|shtml|phtml|php)$"&gt;
      SSLOptions +StdEnvVars
  &lt;/FilesMatch&gt;
  &lt;Directory "C:/Apache2.2/cgi-bin"&gt;
      SSLOptions +StdEnvVars
  &lt;/Directory&gt;
  
  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"
  
  &lt;/VirtualHost&gt;                                  
  </code></pre>
  
  <p>Now I am wondering what is the problem and how to connect to <code>Amazon S3</code> bucket files and <code>RDS</code> database without producing these <code>curl</code> cannot get local issuer certificate problems from my Windows 8 local host.  </p>
  
  <p>Any advice?</p>