CURL get 500 error after 40 seconds
<p>I set all options with timeout and set_time_limit, but it's not help. CURL get 500 error after 40 seconds. On remote server start long process and I need a wait finish. If file is small - all ok, if file is big - get 500 error after 40 seconds. This my code:</p>

<pre><code>$curl = curl_init("http://example.com/index.php?page=uploads");
    curl_setopt($curl, CURLOPT_POST, 1);
    $datas = array(
        "id" =&gt; $id,
        "video" =&gt; $filename-&gt;new_file_name,
        "title" =&gt; $_POST["title"],
        "description" =&gt; $_POST["description"],
        "category" =&gt; array($_POST["category"]),
        "location" =&gt; $_POST["location"],
        "check" =&gt; $check,
        "start" =&gt; $start,
        "duration" =&gt; $duration
    );
    $data = json_encode($datas);

    $fp = fopen(dirname(__FILE__).'/errorlog.txt', 'w');
    curl_setopt($curl, CURLOPT_VERBOSE, 1);
    curl_setopt($curl, CURLOPT_STDERR, $fp);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
    curl_setopt($curl, CURLOPT_TIMEOUT_MS, 900000);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_NOSIGNAL, 1);
    curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
    curl_setopt($curl, curl_exec, 0);
    curl_exec($curl);
    print_r(curl_getinfo($curl));
    curl_close($curl);
</code></pre>