찾다

 >  Q&A  >  본문

502 - 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

怪我咯怪我咯2791일 전1499

모든 응답(12)나는 대답할 것이다

  • 天蓬老师

    天蓬老师2017-04-10 16:15:35

    我运行没问题

    회신하다
    0
  • PHP中文网

    PHP中文网2017-04-10 16:15:35

    HTTPS的问题,在fastcgi_pass这个配置的后面加上 fastcgi_param HTTPS on; 应该就可以解决问题

    회신하다
    0
  • 취소회신하다