最近因为centos停止维护,遂迁移系统的时候,优先考虑使用ubuntu22.04,alibaba cloud 3以及openeurl22.03系统,旧项目因为没人维护,所以环境还是用的php5.6,结果在新系统上编译安装php5.6的时候,表面看着一切正常,实际在使用中php程序在调用curl扩展去访问https站点(比如微信接口)的时候,会出现502错误,导致系统无法使用。
开始排查,感觉应该是openssl版本问题,重新编译openssl,并在php5.6编译的时候,指定对应的openssl版本进行编译,
结果尝试各种版本,要嘛无法安装成功,直接报错,要嘛可以安装成功,但是同样在程序使用curl的时候报错
经过研究,发现是由于curl对应的openssl版本太高导致的,curl调用的openssl跟安装php时候,编译参数里面使用的–with-openssl并没有关系,通过phpinfo查看curl扩展的时候,在curl模块中,有个ssl version是指定了curl使用的openssl版本的
于是决定重新编译一个curl,并指定使用openssl,j结果也是编译不成功,通过检查以前centos7下正常服务器的配置发现,发现旧版的curl扩展ssl vsersion都是使用nss,于是改变方式,重新编译curl的时候,指定ssl为nss,然后再通过扩展的方式安装进去,经过测试,总算是成功解决该问题
整理步骤如下: