一天的整理,仅供参考!
$a=new Mongo();上述代码执行时会报错,如下所示:
Fatal error: Class 'Mongo' not found in /Users/mfw/PhpstormProjects/KeenSting/control/exprement.php on
line 17
我安装的是MAMP集成开发环境
phpstorm中的配置如下
查了很久的资料才发现是MAMP中的php没有扩展mongodb功能,系统自带的php我倒是撞了mongodb但是因为缺少php-cgi,所以根本没什么卵用--网页直接输入localhost:27017可以接入mac自带的php所扩展的mongo,而phpstorm职能连mamp,mamp没有mongo,所以就要给他装上
开始安装
1,这里要用到brew安装,没有的可以去度娘找找homebrew安装的教程,比较快,但是需要XCODE的支持,没有的去applestore down一个吧,免费,安装完需要启动一次再退出
Starting to download mongo-1.6.10.tgz (209,087 bytes)
.............................................done: 209,087 bytes
118 source files, building
running: phpize
grep: /Applications/MAMP/bin/php/php5.6.10/include/php/main/php.h: No such file or directory
grep: /Applications/MAMP/bin/php/php5.6.10/include/php/Zend/zend_modules.h: No such file or directory
grep: /Applications/MAMP/bin/php/php5.6.10/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
Starting to download mongo-1.6.10.tgz (209,087 bytes)
.............................................done: 209,087 bytes
118 source files, building
running: phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
Cannot find autoconf. Please check your autoconf installation and the
Warning: You have an outdated version of /usr/bin/install_name_tool installed.
This will cause binary package installations to fail.
This can happen if you install osx-gcc-installer or RailsInstaller.
To restore it, you must reinstall OS X or restore the binary from
the OS packages.
==> Downloading https://homebrew.bintray.com/bottles/autoconf-2.69.yosemite.bott
######################################################################## 100.0%
==> Pouring autoconf-2.69.yosemite.bottle.1.tar.gz
downloading mongo-1.6.10.tgz ...
Starting to download mongo-1.6.10.tgz (209,087 bytes)
..........................................done: 209,087 bytes
118 source files, building
running: phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
Installing '/Applications/MAMP/bin/php/php5.6.10/lib/php/extensions/no-debug-non-zts-20131226/mongo.so'
install ok: channel://pecl.php.net/mongo-1.6.10
configuration option "php_ini" is not set to php.ini location
You should add "extension=mongo.so" to php.ini