如何在OSX上为XAMPP安装PHP MongoDB驱动程序? [英] How to Install PHP MongoDB Driver for XAMPP on OSX?
问题描述
为了在Macbook Pro的XAMPP上的PHP上使用"MongoClient"和PHP,我在命令终端上输入了以下命令:
I entered the following commands on my command terminal in order to use the 'MongoClient' with PHP on XAMPP on my Macbook Pro:
- 简单安装wget
- 酿造autoconf
- sudo/Applications/XAMPP/xamppfiles/bin/pecl安装mongo
- 将extension = mongo.so添加到php.ini中 /Applications/XAMPP/xamppfiles/etc
- 重新启动Apache
- brew install wget
- brew install autoconf
- sudo /Applications/XAMPP/xamppfiles/bin/pecl install mongo
- Added extension=mongo.so to php.ini /Applications/XAMPP/xamppfiles/etc
- Restarted Apache
但是,我没有运气.我不断收到此错误:致命错误:在第5行的/Applications/XAMPP/xamppfiles/htdocs/xampp/index.php中找不到类'MongoClient'
However, I have had no luck. I keep getting this error: Fatal error: Class 'MongoClient' not found in /Applications/XAMPP/xamppfiles/htdocs/xampp/index.php on line 5
我有点沮丧,因为我真的不知道还能尝试什么.有什么建议吗?
I'm getting kind of frustrated because I don't really know what else to try. Any advice?
推荐答案
您需要启动mongod
酿造更新
酿造mongodb
mkdir -p/data/db
mkdir -p /data/db
mongod --dbpath/data/db
mongod --dbpath /data/db
在第一次运行mongod
之前,请确保运行mongod的用户帐户对/data/db
目录具有read
和write
权限.
Before running mongod
for the first time, ensure that the user account running mongod has read
and write
permissions for the /data/db
directory.
安装MongoDB PHP驱动程序
Install MongoDB PHP driver
简单安装php56-mongo
brew install php56-mongo
OR
sudo pecl install mongo
sudo pecl install mongo
这篇关于如何在OSX上为XAMPP安装PHP MongoDB驱动程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!