我的服务器是 nginx + php-fpm
下面的代码将导致错误
file_get_contents('https://github.com');
或者
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://github.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$output = curl_exec($ch); //crash here
curl_close($ch);
网页显示502错误
nginx日志是
[错误] 2656#0: *541 recv() 失败 (104: Connection reset by peer) while reading response header from upstream
fpm 日志是
7 月 3 日 00:37:37.619903 [通知] fpm_got_signal(),第 48 行:收到 SIGCHLD
Jul 03 00:37:37.619926 [WARNING] fpm_children_bury(), line 215: child 3567 (pool default) exited on signal 11 SIGSEGV (core dumped) after 417.576755 seconds from start
7 月 3 日 00:37:37.620807 [通知] fpm_children_make(), line 352: child 4193 (pool default) 开始
如果请求 url 以 http:// 开头,则一切正常。
php配置命令是
'./configure' '--prefix=/www/nginx_php-5.2.17' '--with-config-file-path=/www/nginx_php-5.2.17/etc' '--with-mysql=/www/mysql' '--with-iconv=/usr' '--with-freetype-dir' '--with-jpeg-dir' '--with-png-dir' '--with-zlib' '--with-libxml-dir=/usr' '--enable-xml' '--disable-rpath' '--enable-discard-path' '--enable-inline-optimization' '--with-curl' '--enable-mbregex' '--enable-mbstring' '--with-mcrypt=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-openssl' '--with-mhash' '--enable-ftp' '--enable-sockets' '--enable-zip' '--enable-fastcgi' '--enable-fpm' '--with-fpm-conf=/www/etc/php-fpm.conf'