How to install PHP MongoDB driver for XAMPP on OSX?

I entered the following commands into my command terminal to use "MongoClient" from PHP to XAMPP on my Macbook Pro:

  • 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.
  • Restarting Apache

However, I was out of luck. I keep getting this error: Fatal error: Class 'MongoClient' not found in /Applications/XAMPP/xamppfiles/htdocs/xampp/index.php on line 5

I get frustrated because I really don't know what else to try. Any advice?

+3


source to share


1 answer


You need to run mongod

brew update

brew install mongodb

mkdir -p / data / db

mongod --dbpath / data / db

Before you run mongod

for the first time, make sure that the user account that works with mongod, has permission read

and write

for the catalog /data/db

.

Install PHP MongoDB driver



brew install php56-mongo

OR

sudo pecl install mongo

+5


source







All Articles