title: curl halts script execution
body: <p>my script uses curl to upload images to <a href="http://www.smugsmug.com/" rel="nofollow noreferrer">smugsmug</a> site via <a href="http://wiki.smugmug.net/display/API/show+1.2.2?method=smugmug.images.upload" rel="nofollow noreferrer">smugsmug api</a>.
  i loop through a folder and upload every image in there. but after 3-4 uploads, curl_exec would fail, stopped everything and prevent other images from uploading.</p>
  
  <pre><code>$upload_array = array(
      "method" =&gt; "smugmug.images.upload",
      "SessionID" =&gt; $session_id,
      "AlbumID" =&gt; $alb_id,
      "FileName" =&gt; zerofill($n, 3) . ".jpg",
      "Data" =&gt; base64_encode($data),
      "ByteCount" =&gt; strlen($data),
      "MD5Sum" =&gt; $data_md5);
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
  curl_setopt($ch, CURLOPT_POSTFIELDS, $upload_array);
  curl_setopt(
      $ch, CURLOPT_URL, 
      "https://upload.smugmug.com/services/api/rest/1.2.2/");
  $upload_result = curl_exec($ch); //fails here
  curl_close($ch);
  </code></pre>
  
  <p>updated:
  so i added logging into my script. when it does fail, the logging stops after <strong>fwrite($fh, "begin curl\n");</strong></p>
  
  <pre><code>fwrite($fh, "begin curl\n");
  $upload_result = curl_exec($ch);
  fwrite($fh, "curl executed\n");
  fwrite($fh, "curl info: ".print_r(curl_getinfo($ch,true))."\n");
  fwrite($fh, "xml dump: $upload_result \n");
  fwrite($fh, "curl error: ".curl_error($ch)."\n");
  </code></pre>
  
  <p>i also </p>
  
  <pre><code>curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60*60);
  </code></pre>