ubuntu24.04 php7.4.33编译安装扩展openssl.so

0.ubuntu24.04 下默认安装的是 openssl3.0,php7.4.33只支持openssl1.1

1.下载OpenSSL 1.1.1w源码,编译安装,本人安装在/usr/local/ssl

2.进入到php-7.4.33/ext/openssl下,执行 phpize
如果出现Cannot find config.m4;可以把config0.m4改为config.m4
export PKG_CONFIG_PATH=/usr/local/ssl/lib/pkgconfig
export CPPFLAGS=-I/usr/local/ssl/include
export LDFLAGS=-L/usr/local/ssl/lib
export OPENSSL_CONF=/usr/local/ssl/openssl.cnf

./configure --with-openssl=/usr/local/ssl
make -j && make install

3.配置扩展证书:openssl.capath=/usr/lib/ssl/certs