php-fpm nginx 使用 curl 请求 https 出现 502 错误

用php curl请求https的url出现502错误,请求帮忙解决。

PHP版本:5.6.7
Nginx版本:1.8.0

代码如下:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.baidu.com');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_exec($ch);

php-fpm日志:

 
[28-Jun-2015 04:04:20] NOTICE: [pool www] child 21701 started
[28-Jun-2015 04:07:33] WARNING: [pool www] child 21692 exited on signal 11 (SIGSEGV) after 222.256700 seconds from start
[28-Jun-2015 04:07:33] NOTICE: [pool www] child 21735 started


之前使用CentOS没有遇到过这个问题。
今天在我的mac上进行微信扫码付款开发的时候,遇到了502.
nginx的日志和php的日志都看不出来,最终Google到了这里。

我的解决办法跟楼主差不多。但是,我重新编译了curl之后,输入curl -V,发现版本不是我装的版本,也就是说系统自带了一个版本,是7.43.我装的是7.50.1.
无奈只好把7.43咔嚓掉,才能好好的运行我安装的。
重启php,发现php里面的curl版本还是7.43,不是我安装的。
最后,还是重装了一下php。问题终于解决。

原文地址:https://www.cnblogs.com/xiaoleiel/p/8334768.html