Vimzy
Vimzy

Reputation: 1985

How to Install PHP MongoDB Driver for XAMPP on OSX?

I entered the following commands on my command terminal in order to use the 'MongoClient' with PHP on XAMPP on my Macbook Pro:

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?

Upvotes: 4

Views: 14768

Answers (1)

Adnan
Adnan

Reputation: 2031

You need to start mongod

brew update

brew install mongodb

mkdir -p /data/db

mongod --dbpath /data/db

Before running mongod for the first time, ensure that the user account running mongod has read and write permissions for the /data/db directory.

Install MongoDB PHP driver

brew install php56-mongo

OR

sudo pecl install mongo

Upvotes: 5

Related Questions