1、安裝phpize --phpize是用來擴展php擴展模塊的 通過phpize可以建立php的外掛模塊
mac os系統下:
問題一:
執行執行 phpize 報錯:
1
2
3
4
5
6
7
|
grep : /usr/include/php/main/php .h: No such file or directory grep : /usr/include/php/Zend/zend_modules .h: No such file or directory grep : /usr/include/php/Zend/zend_extensions .h: No such file or directory Configuring for : PHP Api Version: Zend Module Api No: Zend Extension Api No: |
解決辦法:
1
2
3
|
sudo ln -s /Applications/Xcode .app /Contents/Developer/Platforms/MacOSX .platform /Developer/SDKs/MacOSX10 .9.sdk /usr/include /usr/include |
問題二:
如果執行 phpize 提示如下錯誤:
1
2
|
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. |
解決辦法:
先安裝Homebrew:
1 | ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" |
然後安裝 autoconf :
1 |
brew install autoconf
|
參考鏈接:http://my.oschina.net/Twitter/blog/287543
2、安裝protobuf
參考鏈接:http://blog.sina.com.cn/s/blog_85759f2b0101h3rf.html
phpize
./configure
make
make install
打開擴展:
extentsion = protobuf.so
重啓apache 服務