需要先在appstore安裝xcode
xcode-select --install (安裝command line developer tools)
brew install autoconf
下載php使用版本的sourcecode
解壓縮放在
/Applications/MAMP/bin/php/phpx.x.x/include/
並將資料夾改名為php
(若不執行這步,在編譯的時候可能會遇到php.h錯誤)
cd /Applications/MAMP/bin/php/phpx.x.x/include/php
./configure
(若出現Please specify the install prefix of iconv with --with-iconv=<DIR>
則改用./configure --without-iconv)
(若出現Please specify the install prefix of iconv with --with-iconv=<DIR>
則改用./configure --without-iconv)
(若不執行這步,在編譯的時候可能會遇到zend_config.h錯誤)
cd /Applications/MAMP/bin/php/phpx.x.x/bin/
sudo ./pecl install mongo
裝好之後記得改一下php.ini (在選單列File>Edit template>PHP>PHP x.x.x.ini)
加入
extension=mongo.so
沒有留言:
張貼留言