title: PHP curl put 500 error
body: <p>I have a curl put request that works fine on my localhost but on the live server it throws back a 500 error. Here is my code:</p>
  
  <pre><code>public static function send( $xml )
  {
      $xml = str_replace( "\n", "", $xml );
  
      //Write to temporary file
      $put_data = tmpfile();
      fwrite( $put_data, $xml );  
      fseek( $put_data, 0 );
  
      $options = array(
              CURLOPT_URL =&gt; 'http://*****************/cgi-bin/commctrl.pl?SessionId=' . Xml_helper::generate_session_id() . '&amp;SystemId=live',
              CURLOPT_RETURNTRANSFER =&gt; 1,
              CURLOPT_HTTPHEADER =&gt; array( 'Content-type: text/xml' ),
              CURLOPT_PUT =&gt; TRUE,
                  CURLOPT_INFILE =&gt; $put_data,
              CURLOPT_INFILESIZE =&gt; strlen( $xml )
          );
  
          $curl = curl_init();
          curl_setopt_array( $curl, $options );
          $result = curl_exec( $curl );
          curl_close( $curl );
  
          return $result;
      }
  </code></pre>
  
  <p>I do have curl enabled on the server!</p>
  
  <p>Does anyone have any ideas why it is not working on the server? I am on shared hosting if that helps.</p>
  
  <p>I also have enabled error reporting at the top of the file but no errors show after the curl has completed. I just get the generic 500 error page.</p>
  
  <p>Thanks</p>
  
  <p>UPDATE:</p>
  
  <p>I have been in contact with the client and they have confirmed that the information that is sent is received by them and inserted into their back office system. So it must be something to do with the response that is the cause. It is a small block of xml that is suppose to be returned.</p>
  
  <p>ANOTHER UPDATE</p>
  
  <p>I have tried the same script on a different server and heroku and I still get the same result.</p>
  
  <p>ANOTHER UPDATE</p>
  
  <p>I think I may have found the route of the issue. The script seems to be timing out because of a timeout on FastCGI and because I am on shared hosting I can not change it. Can any one confirm this?</p>
  
  <p>FINAL UPDATE</p>
  
  <p>I got in contact with my hosting provider and they confirmed that the script was timing out due to the timeout value on the server not the one I can access with any PHP function or ini_set().</p>