Lnmp one-click package installation, php5.x version of curl access https appears 502 Bad Gateway,http request successful

problem description

I use the lnmp1.4 version to install the php development environment with one click. My system version is Ubuntu 18.04.1 LTS.
. As long as I send the curl https request in the php5.x version, there will be a 502 error, but http will not appear in the above php7 version (the same code). I have built the php7.1.17 version + php5.6 version locally to test

the environmental background of the problems and what methods you have tried

I have done a lot of things in Baidu, and I have tried to increase the number of request_terminate_timeout,max_children in php-fpm.conf, but the problem still exists. Then I recompile the lnmp1.4 version 5.5 test, and then my curl https appears 502, which is not possible only if I use the php7.0 version. My system has been upgraded before

related codes

/ / Please paste the code text below (do not replace the code with pictures)

modify php.ini file

output_buffering = 65535

View nginx error log

jingmian@jingmian-TUF:/home/wwwlogs$ cat nginx_error.log

2018/09/17 21:12:23 [error] 21050-sharp0: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: _, request: "GET /3.php HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "127.0.0.1"

php-frm profile

root@jingmian-TUF:/usr/local/php/etc-sharp cat php-fpm.conf
[global]
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
log_level = notice

[www]
listen = /tmp/php-cgi.sock
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 6
request_terminate_timeout = 100
request_slowlog_timeout = 0
slowlog = var/log/slow.log

php-frm.log error log
[17-Sep-2018 21:12:23] WARNING: [pool www] child 20874 exited on signal 11 (SIGSEGV-core dumped) after 8428.414089 seconds from start
[17-Sep-2018 21:12:23] NOTICE: [pool www] child 26731 started

php has prompted to install the module
root@jingmian-TUF:/usr/local/php/var/log-sharp / usr/local/php/bin/php-m

[PHP Modules]
bcmath
Core
ctype
curl
date
dom
ereg
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvsem
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend Guard Loader
zip
zlib

[Zend Modules]
Zend Guard Loader

jingmian@jingmian-TUF:~$ curl -V
curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Release-Date: 2018-01-24
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL 
jingmian@jingmian-TUF:~$ 
    

Local curl

jingmian@jingmian-TUF:/home/wwwlogs$ curl https://www.sojson.com/api/qqmusic/8446666
curl: (7) Failed to receive SOCKS4 connect request ack.
jingmian@jingmian-TUF:/home/wwwlogs$ curl http://www.sojson.com/api/qqmusic/8446666
curl: (7) Failed to receive SOCKS4 connect request ack.
jingmian@jingmian-TUF:/home/wwwlogs$ curl http://www.baidu.com
curl: (7) Failed to receive SOCKS4 connect request ack.
jingmian@jingmian-TUF:/home/wwwlogs$ curl http://www.sojson.com/api/qqmusic/8446666

3.php test file

<?php
$header=array(
"Accept: application/json",
"Content-Type: application/json;charset=utf-8",
);
$get_token_url="https://www.sojson.com/api/qqmusic/8446666";
//$get_token_url="https://www.baidu.com";
$ch = curl_init();

curl_setopt($ch,CURLOPT_URL,$get_token_url);

curl_setopt($ch,CURLOPT_HEADER,0);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //

curl_setopt($ch,CURLOPT_RETURNTRANSFER,0 );
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
//curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,10);

$res = curl_exec($ch);
$b=curl_error($ch);var_dump($b);die();
var_dump($res);  //
?>

what result do you expect? What is the error message actually seen?

I wonder if it was the problem with my upgrade system that led to 502 in the 5.x version of curl https. I just didn"t have to reinstall the system. Is there any other way to solve it? My php7 version is normal, all using the same Nginx version agent

Dec.03,2021

is not the problem of your upgrade, is it? my new installation is also reporting this error


php 50290% is the response time after php connection is too short or the one-way communication is disconnected

.
Menu