MAC系統下phpstorm不能基於MAXP使用MongoDB的結局辦法

WBOY
發布: 2016-08-08 09:20:15
原創
857 人瀏覽過

一天的整理,僅供參考!

$a=new Mongo(); 上述程式碼執行時會報錯,如下圖所示:

Fatal error: Class 'Mongo' not found in /Users/mfw/PhpstormProjects/KeenSting/control/exprement.phponon line 17

我安裝的是MAMP整合開發環境

phpstorm中的設定如下


帶的php我倒是撞了mongodb但是因為缺少php-cgi,所以根本沒什麼卵用-網頁直接輸入localhost:27017可以接入mac自帶的php所擴展的mongo,而phpstorm職能連mamp,mamp沒有mongo ,所以就要為他裝上

開始安裝

1,這裡要用到brew安裝,沒有的可以去度娘找找homebrew安裝的教程,比較快,但是需要XCODE的支持,沒有的去applestore down一個吧,免費,安裝完要啟動一次再退出


2,安裝mongodb(需要root權限 控制台輸入sudo -s,回車後輸入密碼即可)- 3.2# /Applications/MAMP/bin/php/php5.6.10/bin/pecl install mongo結果出錯downloading mongotg-16.10. .10.tgz (209,087 bytes)......................................... ....done: 209,087 bytes118 source files, building
running: phpize
grep: /Applications/MAMP/bin/php/php5.6.10/include/php/main/php.h: No suchtory file or 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. Plcommend yourkutoft Api No:
Cannot find a自動Then, rerun this script.




ERROR: `phpize' failed 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# /lications downloading mongo-1.6.10.tgz ...Starting to download mongo-1.6.10.tgz (209,087 bytes).................... ................................done: 209,087 bytes118 source files, buildingrunning: phpizeConfiguring for:PHP Api Version:         20100412 Zend Module Api No:      20100525Zend Extension Api No:   220100525Cannot find autoconf. Please check your autoconf installation and theCannot find autoconf. Please check your autoconf installation and theg n, rerun this script.








ERROR: `phpize' failed
4,說是找不到autoconfig,那就安裝吧! ! (這裡要退出root狀態)KeenStings-MacBook-Pro:~ mfw$ brew install autoconfWarning: 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 fromthe OS package. 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
:St5, /Applications /MAMP/bin/php/php5.6.10/bin/pecl install mongo提示loadz. mongo-1.6.10.tgz (209,087 bytes)...................................... ....done: 209,087 bytes118 source files, buildingrunning: phpizeConfiguring for:PHP Api Version:       Zend Extension Api No:   220100525


Build with Cyrus SASL (MongoDB Enterprise Authentication) support? [no]





6,輸入yes回車 最後是這個Build process completed successf.Installing '/Applications/MAMP/bin/php/php5.6.10/lib/php/ext. so'install ok: channel://pecl.php.net/mongo-1.6.10configuration option "php_ini" is not set to php.ini locationYou should add "extension=mongo.so" to php.ini KeenStings-MacBook-Pro:~ mfw$7,到你的位置去吧?



看教程就一回,但是我找了一天的資料== 以上就介紹了MAC系統下phpstorm不能基於MAXP使用MongoDB的結局辦法,包含了面向的內容,希望對PHP教學有興趣的朋友有幫助。
相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板