注意的是php5.6要安装openssl 1.1以下版本
wget https://www.openssl.org/source/old/1.0.0/openssl-1.0.0.tar.gztar xzvf openssl-1.0.0.tar.gzcd 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/sslmake && make install
安装openssl报错
POD document had syntax errors at /usr/bin/pod2man line 69
解决办法
mv /usr/bin/pod2man /usr/bin/pod2man.bak
PHP增加openssl扩展
安装步骤
# 进入PHP源码目录
cd php-5.6.24/ext/opensslcp 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
参考文章
编译和安装openssl时出错,POD document had syntax errors
openssl1.0在mac下的编译安装(踩坑精华)
Mac OS编译安装php-openssl出错,error: Cannot find OpenSSL’s /evp.h