注意的是php5.6要安装openssl 1.1以下版本
wget https://www.openssl.org/source/old/1.0.0/openssl-1.0.0.tar.gz
tar xzvf openssl-1.0.0.tar.gz
cd openssl-1.0.0
# 编译支持的系统查看
uname -a
./Configure LIST | grep darwin
# 默认会生成shared库(动态),如果加上no-shared,就不会生成动态库
./Configure darwin64-x86_64-cc --prefix=/usr/local/opt/openssl no-asm --openssldir=/usr/local/ssl
# 生成MakeFile
./config
./Configure darwin64-x86_64-cc
# 重新配置Makefile
./Configure darwin64-x86_64-cc --prefix=/usr/local/opt/openssl no-asm --openssldir=/usr/local/ssl
make && make install
POD document had syntax errors at /usr/bin/pod2man line 69
解决办法
mv /usr/bin/pod2man /usr/bin/pod2man.bak
安装步骤
# 进入PHP源码目录
cd php-5.6.24/ext/openssl
cp config0.m4 config.m4
/usr/local/php5.6/bin/phpize
./configure --enable-openssl --with-openssl-dir=/usr/local/Cellar/openssl/1.0.2r/ --with-php-config=/usr/local/php5.6/bin/php-config
./configure --with-openssl=/usr/local/Cellar/openssl/1.0.2l/
./configure --with-php-config=/usr/local/php5.6/bin/php-config --with-openssl=/usr/local/Cellar/openssl/1.0.2r/
make && make install
php.ini文件添加
extension=openssl.so
然后重启PHP