mac php 5.6 安装 openssl mongo mongodb redis扩展

brew有废弃的5.6的版本可以安装。但是又需要安装xcode最新版,xcode又要求os版本升级。

所以还是编译下5.6

1,首先安装openssl

    需要注意的是php5.6要安装openssl 1.1以下版本,我安装的是openssl-OpenSSL_1_0_2h,本地目录是/usr/local/opt/[email protected]

2,安装php

./configure --prefix=/usr/local/Cellar/[email protected]/5.6.40 -enable-fpm --enable-cli --with-mysql=/usr/local/Cellar/[email protected]/5.7.32 --with-pdo-mysql=/usr/local/opt/[email protected]/bin/mysql --with-config-file-path=/usr/local/Cellar/[email protected]/5.6.40/etc --with-iconv=/usr/local/Cellar/libiconv/1.16 --enable-mbstring --with-openssl=/usr/local/opt/[email protected]
# 在make之前需要将Makefile的EXTRA_LIBS加上libiconv的动态包的地址,我本地是 /usr/local/opt/libiconv/lib/libiconv.dylib
make && make install

3,安装mongo

wget http://pecl.php.net/get/mongo-1.6.13.tgz
tar zxvf mongo-1.6.13.tgz
cd mongo-1.6.13
# mongo扩展需要openssl的支持,但是它又没有类似--with-openssl-dir的选项可以直接指定openssl的目录,所以只能是添加个软连接到系统include的目录
ln -s /usr/local/opt/[email protected]/include/openssl /usr/local/include
/usr/local/Cellar/[email protected]/5.6.40/bin/phpize
./configure --with-php-config=/usr/local/Cellar/[email protected]/5.6.40/bin/php-config
make && make install

# 添加.so文件到php.ini

4,安装redis扩展

wget http://pecl.php.net/get/redis-3.1.1.tgz


#其余步骤和安装mongo一样,只是不需要ln那一步

5,安装mongodb扩展

wget http://pecl.php.net/get/mongodb-1.4.3.tgz


#其余步骤和安装mongo一样,只是不需要ln那一步

 

你可能感兴趣的:(php)