接上文说 对接三方平台接口, curl 请求接口 抛错
OpenSSL/1.0.2k-fips: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
网上搜了很多 , 有说设置升级php8.0 有的说强制设置 1.0 还有的如下
curl --tlsv1.2 -X GET ....
都不解决问题.
原因就是第三方不支持 OpenSSL 1.0.2k 以下版本.
升级是可行的, 但不是升级php8.0, 而是本地的 openssl , 由于是亚马逊的centos 没有办法yum 升级(吐槽亚马逊).
$ wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz
$ tar xvf openssl-1.1.1k.tar.gz
$ cd openssl-1.1.1k/
$ ./config --prefix=/usr/local/openssl
$ make && make install
安装后 curl 请求扔失败 , 见了鬼了, 好吧重新安装下curl
wget https://curl.haxx.se/download/curl-8.6.0.tar.gz
tar zxf curl-8.6.0.tar.gz
cd curl-8.6.0/
./configure --without--with-ssl
make && make install
history |grep configure
./configure --prefix=/usr/local/curl/ --without-nss --with-ssl
安装失败 缺东西呀 .
yum install libpsl
yum install libpsl-dev
yum install libpsl-devel
./configure --prefix=/usr/local/curl/ --without-nss --with-ssl
make && make install
ls /usr/local/curl/bin/curl
/usr/local/curl/bin/curl -V
./configure --help
./configure --prefix=/usr/local/curl/ --without-nss --with-ssl --with-openssl=/usr/local/openssl/
make && make install
/usr/local/curl/bin/curl -V
上面是韵味同学给的 history .
记录一下 预防踩坑