我按照以下步骤操作:
来自github的git clone mongodb驱动程序
git clone https://github.com/mongodb/mongo-php-driver.git cd mongo-php-driver git submodule update --init /Applications/MAMP/bin/php/php5.6.10/bin/phpize ./configure --with-php-config = / Applications / MAMP / bin / php / php5.6.10 / bin / php-config 做所有 sudo make install
open mamp pro - >文件 - >编辑模板 - > php,添加
extension=mongodb.so
。
mongo
。
无!! 有人可以帮我弄清楚为什么mongodb.so不工作?
答案 0 :(得分:2)
试试这个,它正在运作
1, goto [php official site][1] download php.5.6.x
2,unpack the file, paste it to /Applications/MAMP/bin/php/php5.6.x/inclue/, you need mkdir and remaned to dirname php
3, drag ../include/php folder to terminal screen, and run: ./configure
4, run: sudo /Applications/MAMP/bin/php/php5.6.x/bin/pecl install mongo or mongodb
5, go to mamp pro->file->php template->php5.6.x.ini, paste ,just like
extension=/usr/local/Cellar/php56/5.6.22/lib/php/extensions/no-debug-non-zts-20131226/mongo.so
extension=/usr/local/Cellar/php56/5.6.22/lib/php/extensions/no-debug-non-zts-20131226/mongodb.so
6, restart mamp pro -> webstart page-> phpinfo -> search mongo yeah, have them, enjoy it.