Install MongoDB + phpMongoDriver in Mac OSX High Sierra

Posted by nopsled
2018.09.13 16:25 데이터베이스

 brew install mongodb 

First, you have to install mongodb.

nopsled@smleeo3o:~/dump (=`ω´=)$ php -v

PHP 7.1.7 (cli) (built: Jul 15 2017 18:08:09) ( NTS )

Copyright (c) 1997-2017 The PHP Group

Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies 

Second, check your php version. this example's php version is 7.1.

 brew tap kyslik/php

 brew install php71-mongodb

Third, we have to install php MongoDriver 7.1

nopsled@smleeo3o:~ (=`ω´=)$ cd /usr/local/Cellar/php71-mongodb/1.4.0

nopsled@smleeo3o:/usr/local/Cellar/php71-mongodb/1.4.0 (=`ω´=)$ ls


nopsled@smleeo3o:/usr/local/Cellar/php71-mongodb/1.4.0 (=`ω´=)$ cp /etc/php.ini.default /etc/php.ini 

Check file and copy your /etc/php.ini.default to /etc/php.ini.

 878 ; ... or with a path:

 879 ;

 880 ;   extension=/path/to/extension/

 881 ;

 882     extension=/usr/local/Cellar/php71-mongodb/1.4.0/

 883 ; If you only provide the name of the extension, PHP will look for it in its

 884 ; default extension directory.

 885 ;

 886 ; Windows Extensions 

And you have to add files location in /etc/php.ini.

 nopsled@smleeo3o:/usr/local/Cellar/php71-mongodb/1.4.0 (=`ω´=)$ sudo apachectl restart

restart your apache.

이 댓글을 비밀 댓글로