php扩展安装,指定新的openssl 1 自己从源码编译一个新的openssl 2 编译php_openssl,链接新的openssl 3 编译mongodb,需要依赖openssl ,链接新的openssl

下载源码下来解压到 /mnt/soft/openssl-1.0.2m (openssl 安装到)

./config -h
/usr/bin/perl ./Configure  -h

./config shared --prefix=/usr/mylibs --openssldir=/usr/mylibs/ssl 
-Wl,-rpath=/usr/mylibs/lib

make clean
make
make install

2 编译php_openssl,链接新的openssl

prefix 是安装目录,openssldir 是配置文件目录,另外建议安装两次,shared 作用是生成动态连接库。

wget ftp://ftp.openssl.org/source/openssl-1.0.0c.tar.gz
tar -zxf openssl-1.0.0c.tar.gz
cd openssl-1.0.0c/

运行php安装目录下的phpize文件,这时候会在extension目录下生成相应的configure文件。(php71为指定的PHP版本)

/usr/local/php71/bin/phpize


必须:指定openssl 目录
export PKG_CONFIG_PATH=/usr/mylibs/lib/pkgconfig pkg-config --cflags --libs libssl

./configure --with-openssl=/usr/mylibs --with-php-config=/usr/local/php71/bin/php-config

 make && make install

3 编译mongodb,需要依赖openssl ,链接新的openssl

 
下载mongodb
tar -zvxf mongodb-1.5.5.tar.gz
cd mongodb-1.5.5
/usr/local/php71/bin/phpize

指定openssl依赖
/usr/mylibs
export PKG_CONFIG_PATH=/usr/mylibs/lib/pkgconfig

pkg-config --cflags --libs libssl

./configure --with-php-config=/usr/local/php71/bin/php-config
make && make install