title: 287 is not a valid cURL handle resource
body: <p>Recently switched server from Apache2 to nginx/1.4.6 with PHP5-FPM and every time i try to run curl i get:</p>
  
  <pre><code>curl_error(): 287 is not a valid cURL handle resource
  </code></pre>
  
  <p>Curl is installed (running "curl url" in CLI works fine), the PHP module is also installed.</p>
  
  <p>My code:</p>
  
  <pre><code>$file_name_with_full_path = $composed_filename;
  $post = array('image'=&gt;'@'.$file_name_with_full_path);
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, "url");
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt ($ch, CURLOPT_PORT , 443);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_SSLVERSION, 3);
  curl_setopt($ch, CURLOPT_TIMEOUT, 300);
  $result = curl_exec ($ch);
  curl_close ($ch);
  </code></pre>
  
  <p>I searched around and found several answers, none of them worked. Found one that said that cURL might have removed the handle before it was done, how can i test that?</p>