您好,欢迎访问一九零五行业门户网

MAC系统下phpstorm不能基于MAXP使用MongoDB的结局办法

一天的整理,仅供参考!
$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一个吧,免费,安装完需要启动一次再退出
2,安装mongodb(需要root权限  控制台输入sudo -s,回车后输入密码即可)bash-3.2# /applications/mamp/bin/php/php5.6.10/bin/pecl install mongo结果出错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
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.
error: `phpize' failed3,找到include文件夹(软连接,关联文件夹)bash-3.2# sudo ln -s /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.9.sdk/usr/include /applications/mamp/bin/php/php5.6.10/include再次运行结果还是有问题bash-3.2# /applications/mamp/bin/php/php5.6.10/bin/pecl install mongodownloading 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
cannot find autoconf. please check your autoconf installation and the$php_autoconf environment variable. then, rerun this script.error: `phpize' failed4,说是找不到autoconfig,那就安装!!(这里要退出root状态)keenstings-macbook-pro:~ mfw$ brew install autoconf
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?  /usr/local/cellar/autoconf/2.69: 70 files, 3.1m
5,安装完了执行 keenstings-macbook-pro:~ mfw$ sudo /applications/mamp/bin/php/php5.6.10/bin/pecl install mongo提示password:
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:   220100525build with cyrus sasl (mongodb enterprise authentication) support? [no]6,输入yes回车就好了很长一段提示信息最后是这个build process completed successfully
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.inikeenstings-macbook-pro:~ mfw$7,到你的位置去吧php.ini中加入extension=mongo.so  即可看教程就一回,但是我找了一天的资料==
版权声明:本文为博主原创文章,未经博主允许不得转载。
以上就介绍了mac系统下phpstorm不能基于maxp使用mongodb的结局办法,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。
其它类似信息

推荐信息