title: S3-php5-curl on AWS EC2 instance - requested domain name does not match the server's certificate
body: <p>I am using <a href="https://github.com/julesbravo/s3-php5-curl">s3-php5-curl</a> to access my AWS S3 bucket. </p>
  
  <p>The <code>getBucket()</code> function works fine and retrieves a result when I host the PHP app myself but when I put the exact same code into a AWS EC2 instance (default AIM - Linux, Apache, PHP), I get the following error:</p>
  
  <p><code>Warning: S3::getBucket(): [51] Unable to communicate securely with peer: requested domain name does not match the server's certificate. In /var/www/html/s3-php5-curl/S3.php on line 136 Warning: Invalid argument supplied for foreach() in /var/www/html/index.php on line 15</code> </p>
  
  <p>I can't make sense of it. What does it mean and how can I resolve it?</p>
  
  <p><strong>EDIT: I did mark this as answered but I was wrong. I have linked to what the underlying problem seems to be irrespective of whether you use the Amazon SDK or the php5-curl library.</strong> There seems to be a general problem affecting EC2 users in some regions who try to programmatically access their S3 buckets relating to SSL certification where the bucket name includes a full-stop (aka period). It has been documented but lays unresolved <a href="https://forums.aws.amazon.com/message.jspa?messageID=435421">here</a>.</p>