[PHP] 在 MacOS 上安裝 php mongodb driver
因為用mac透過 pecl 去做一定會狂出問題 所以自己編譯會比較方便 $ git clone https://github.com/mongodb/mongo-php-driver.git $ cd mongo-php-driver $ git submodule update --init $ phpize $ ./configure $ make all $ sudo make install 假如出現 Security/Security.h file not found 可以參考這篇 https://stackoverflow.com/questions/53531008/pecl-install-mongodb-on-mac-fatal-error-security-security-h-file-not-found cd mongo-php-driver/include ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Versions/A/Headers/ Security ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/ CoreFoundation brew install pcre make 最後記得編輯 php.ini vi /etc/php.ini 在裡面新增 extension=mongodb.so 可以先用 php -i | grep extension_dir 得知extension directory在哪 大概像是這樣: 之後進去該目錄,檢查 mongodb.so 是否在裡面 然後用 php -m | grep mongo 檢查是不是有進到設定檔中 這篇也有參考價值 https://www.jianshu.com/p/1fd7c1927ae5 brew install autoconf 如果出現找不...