title: PHP cURL working locally, error 77 on AWS server
body: <p><strong>LATEST UPDATE:</strong> script is running successfully via SSH shell as "php script.php", being an admin user. When run by the nginx user, the curl command fails to do the https request. So I guess it's an issue of nginx user not being able to use curl properly. I've checked tenths of configuration files and cannot find where this could be changed.</p>
  
  <p>I'm trying to post the following JSON</p>
  
  <pre><code>{
      "where": {
        "userId": "97"
      },
      "data": {
        "alert": "Joe Masilotti answered a question you follow",
        "badge": "Increment","eventId":"3","questionId":"8954","answerId":"977"
      }
  }
  </code></pre>
  
  <p>with the following code</p>
  
  <pre><code>$c = curl_init();
  curl_setopt($c, CURLOPT_TIMEOUT, 30);
  curl_setopt($c, CURLOPT_USERAGENT, 'parse.com-php-library/2.0');
  curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($c, CURLINFO_HEADER_OUT, true);
  
  curl_setopt($c, CURLOPT_HTTPHEADER, array(
      'Content-Type: application/json',
      'X-Parse-Application-Id: '.$this-&gt;_appid,
      'X-Parse-REST-API-Key: '.$this-&gt;_restkey
  )); 
  curl_setopt($c, CURLOPT_CUSTOMREQUEST, 'POST');
  
  $postData = str_replace(PHP_EOL,'',$args['data']);
  curl_setopt($c, CURLOPT_POSTFIELDS, $postData );
  $url = $this-&gt;_parseurl . $args['requestUrl'];
  curl_setopt($c, CURLOPT_URL, $url);
  curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
  $response = curl_exec($c);
  </code></pre>
  
  <p>It works on my local Apache. I run this on an nginx server running on AWS EC2 and getting this from cURL</p>
  
  <pre><code>Array
  (
      [url] =&gt; https://api.parse.com/1/push
      [content_type] =&gt; 
      [http_code] =&gt; 0
      [header_size] =&gt; 0
      [request_size] =&gt; 0
      [filetime] =&gt; -1
      [ssl_verify_result] =&gt; 0
      [redirect_count] =&gt; 0
      [total_time] =&gt; 0.012399
      [namelookup_time] =&gt; 0.01232
      [connect_time] =&gt; 0.013486
      [pretransfer_time] =&gt; 0
      [size_upload] =&gt; 0
      [size_download] =&gt; 0
      [speed_download] =&gt; 0
      [speed_upload] =&gt; 0
      [download_content_length] =&gt; -1
      [upload_content_length] =&gt; -1
      [starttransfer_time] =&gt; 0
      [redirect_time] =&gt; 0
      [certinfo] =&gt; Array
          (
          )
  
      [redirect_url] =&gt; 
  )
  
  
  cURL error number:77
  
  cURL error:
  </code></pre>
  
  <p>The same JSON is sent OK from the command line of the AWS EC2 server with the following command</p>
  
  <pre><code>curl -X POST \
    -H "X-Parse-Application-Id: &lt;...&gt;" \
    -H "X-Parse-REST-API-Key:&lt;..&gt;" \
    -H "Content-Type: application/json" \
    -d '{
          "where": {
            "userId": "97"
          },
          "data": {
            "alert": "Joe answered a question",
            "badge": "Increment","eventId":"3","questionId":"8954","answerId":"977"
          }
        }' \
    https://api.parse.com/1/push
  </code></pre>
  
  <p>cURL extension is set up properly on the server, and it works in other scripts. Thanks!</p>
  
  <p><strong>UPDATE:</strong> The script "script.php" runs successfully when run on server from command line as "php script.php", while failing when requested on a browser at "<a href="http://www.mysite.com/script.php" rel="noreferrer">http://www.mysite.com/script.php</a>"</p>
  
  <p><strong>UPDATE:</strong> Here's my curl -V</p>
  
  <pre><code>curl 7.36.0 (x86_64-redhat-linux-gnu) libcurl/7.36.0 NSS/3.16 Basic ECC zlib/1.2.7 libidn/1.18 libssh2/1.4.2
  Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp 
  Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz
  </code></pre>
  
  <p>and I was trying to check curl differences between my local and server PHP configs, I saw that local curl SSL version is <strong>OpenSSL/1.0.1f</strong> while on server is <strong>NSS/3.14.3.0</strong></p>