mac os 安装thrift php

官网教程:

http://thrift.apache.org/docs/install/os_x

不建议使用 brew,不要从官网下载安装,使用github

1. 安装依赖

libevent

boost

bison也需要,自带的是2.3 ,使用 /usr/local/Cellar/bison/3.*里面替换掉/usr/bin/bison

和yacc

2. 安装 thrift

git clone https://github.com/apache/thrift.git

./bootstrap.sh


./configure --prefix=/usr/local/ --with-boost=/usr/local --with-libevent=/usr/local  CPPFLAGS="-I/usr/local/Cellar/openssl/1.0.2j/include" LDFLAGS="-ldl -L/usr/local/Cellar/openssl/1.0.2j/lib" --with-openssl=/usr/local/Cellar/openssl/1.0.2j/bin


--with-openssl=/usr/local/Cellar/openssl/1.0.2j/bin


./configure --prefix=/usr/local/ --with-boost=/usr/local --with-libevent=/usr/local CXXFLAGS='-g -O2' CFLAGS='-g -O2' CPPFLAGS='-DDEBUG_MY_FEATURE'

CPPFLAGS="-I/usr/local/Cellar/openssl/1.0.2j/include" LDFLAGS="-ldl -L/usr/local/Cellar/openssl/1.0.2j/lib" 


注意:参数CPPFLAGS 和 LDFLAGS解决 libcrypto required error


make -j4

这个时候 下载 https://github.com/Medium/phantomjs/releases/download/v1.9.19/phantomjs-1.9.8-macosx.zip

好慢,之后 跨越TGW

下一步:

1. thrift -r --gen php testc.thrift

2. thrift -r --gen php:server tests.thrift

你可能感兴趣的:(mac os 安装thrift php)