I am developing a webpage that uses the Dropbox SDK to do some things. Most of this happens through the CLI but one particular thing must be done in the browser. I stumbled across an interesting issue, though.
$dbxClient = new dbx\Client($accountToken, 'xxx/' . VERSION);
$folderMetadata = $dbxClient->getMetadataWithChildren("/");
Running this code works just fine in CLI. Running it in the browser however gives me a 502. Being baffled I started up xdebug and traced where the problem appears. I found out, that Dropbox' curl-call was causing it so I wrote a small example script to see, if curl works at all. It does not.
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://example.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
Running this code in a browser gives a 502 instantly. If I remove https:// or make it a http:// (or run it in CLI) it works, though. The problem seems to be in PHP7 + curl + SSL. Adding curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
does NOT work.
What can I do to find out, why this happens and how I can solve it?
System Infos:
- OS X 10.11.2
- nginx 1.8.0, installed via homebrew
- PHP 7.0.3, installed via homebrew
- curl 7.43.0, installed via homebrew
- OpenSSL 1.0.2f, installed via homebrew