title: Errors using PHP SDK for Amazon S3
body: <p>EDIT : Problem solved (thanks to <a href="https://stackoverflow.com/questions/22882782/upload-a-file-on-amazon-s3-with-php-sdk">this post</a>) ! I just needed to install curl :</p>
  
  <pre><code>sudo apt-get install php5-curl
  </code></pre>
  
  <hr>
  
  <p>I am working on a tool to upload images in a AWS S3 bucket from a browser. I am using the <a href="http://aws.amazon.com/sdk-for-php/" rel="nofollow noreferrer">PHP SDK</a> provided by Amazon.
  I tried the code provided in the <a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/UploadObjSingleOpPHP.html" rel="nofollow noreferrer">documentation</a>, but it does not work with me:</p>
  
  <pre><code>use Aws\S3\S3Client;
  
  $bucket = '*** Your Bucket Name ***';
  $keyname = '*** Your Object Key ***';
  // $filepath should be absolute path to a file on disk                      
  $filepath = '*** Your File Path ***';
  
  // Instantiate the client.
  $s3 = S3Client::factory();
  
  // Upload a file.
  $result = $s3-&gt;putObject(array(
      'Bucket'       =&gt; $bucket,
      'Key'          =&gt; $keyname,
      'SourceFile'   =&gt; $filepath,
      'ContentType'  =&gt; 'text/plain',
      'ACL'          =&gt; 'public-read',
      'StorageClass' =&gt; 'REDUCED_REDUNDANCY',
      'Metadata'     =&gt; array(    
          'param1' =&gt; 'value 1',
          'param2' =&gt; 'value 2'
      )
  ));
  
  echo $result['ObjectURL'];
  </code></pre>
  
  <p>Even if I keep only these 2 lines:</p>
  
  <pre><code>use Aws\S3\S3Client;
  $s3 = S3Client::factory();
  </code></pre>
  
  <p>...I get these errors:</p>
  
  <blockquote>
    <p>Notice: Use of undefined constant CURLE_COULDNT_RESOLVE_HOST - assumed
    'CURLE_COULDNT_RESOLVE_HOST' in
    phar:///var/www/aws.phar/Aws/S3/S3Client.php on line 244</p>
    
    <p>Notice: Use of undefined constant CURLE_COULDNT_CONNECT - assumed
    'CURLE_COULDNT_CONNECT' in
    phar:///var/www/aws.phar/Aws/S3/S3Client.php on line 244</p>
    
    <p>Notice: Use of undefined constant CURLE_PARTIAL_FILE - assumed
    'CURLE_PARTIAL_FILE' in phar:///var/www/aws.phar/Aws/S3/S3Client.php
    on line 244</p>
    
    <p>Notice: Use of undefined constant CURLE_WRITE_ERROR - assumed
    'CURLE_WRITE_ERROR' in phar:///var/www/aws.phar/Aws/S3/S3Client.php on
    line 244</p>
    
    <p>Notice: Use of undefined constant CURLE_READ_ERROR - assumed
    'CURLE_READ_ERROR' in phar:///var/www/aws.phar/Aws/S3/S3Client.php on
    line 244</p>
    
    <p>Notice: Use of undefined constant CURLE_OPERATION_TIMEOUTED - assumed
    'CURLE_OPERATION_TIMEOUTED' in
    phar:///var/www/aws.phar/Aws/S3/S3Client.php on line 244</p>
    
    <p>Notice: Use of undefined constant CURLE_SSL_CONNECT_ERROR - assumed
    'CURLE_SSL_CONNECT_ERROR' in
    phar:///var/www/aws.phar/Aws/S3/S3Client.php on line 244</p>
    
    <p>Notice: Use of undefined constant CURLE_HTTP_PORT_FAILED - assumed
    'CURLE_HTTP_PORT_FAILED' in
    phar:///var/www/aws.phar/Aws/S3/S3Client.php on line 244</p>
    
    <p>Notice: Use of undefined constant CURLE_GOT_NOTHING - assumed
    'CURLE_GOT_NOTHING' in phar:///var/www/aws.phar/Aws/S3/S3Client.php on
    line 244</p>
    
    <p>Notice: Use of undefined constant CURLE_SEND_ERROR - assumed
    'CURLE_SEND_ERROR' in phar:///var/www/aws.phar/Aws/S3/S3Client.php on
    line 244</p>
    
    <p>Notice: Use of undefined constant CURLE_RECV_ERROR - assumed
    'CURLE_RECV_ERROR' in phar:///var/www/aws.phar/Aws/S3/S3Client.php on
    line 244</p>
    
    <p>Fatal error: Uncaught exception
    'Guzzle\Common\Exception\RuntimeException' with message 'The PHP cURL
    extension must be installed to use Guzzle.' in
    phar:///var/www/aws.phar/Guzzle/Http/Client.php:72 Stack trace: #0
    phar:///var/www/aws.phar/Aws/Common/Client/AbstractClient.php(79):
    Guzzle\Http\Client->__construct('<a href="https://s3.amaz" rel="nofollow noreferrer">https://s3.amaz</a>...',
    Object(Guzzle\Common\Collection)) #1
    phar:///var/www/aws.phar/Aws/Common/Client/ClientBuilder.php(249):
    Aws\Common\Client\AbstractClient->__construct(Object(Aws\Common\Credentials\RefreshableInstanceProfileCredentials),
    Object(Aws\S3\S3Signature), Object(Guzzle\Common\Collection)) #2
    phar:///var/www/aws.phar/Aws/S3/S3Client.php(207):
    Aws\Common\Client\ClientBuilder->build() #3 /var/www/response.php(30):
    Aws\S3\S3Client::factory() #4 {main} thrown in
    phar:///var/www/aws.phar/Guzzle/Http/Client.php on line 72</p>
  </blockquote>