Created
August 10, 2019 09:22
-
-
Save andreconghau/cf6bfb6d2a469475287abfb663759955 to your computer and use it in GitHub Desktop.
How to install mongodb php extension in Mamp Pro MacOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install autoconf | |
php -m | |
php -v | |
which php | |
pecl install mongodb | |
Check Folder | |
/Applications/MAMP/bin/php/php7.0.15/lib/php/extension/no-debug-non-zts | |
update template php.ini to add ext | |
extension=mongodb.so | |
A mongodb.so extension should now be in your /Applications/MAMP/bin/php/php7.0.15/lib/php/extension/no-debug-non-zts folder. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now, We just need to swap this over to the PHP that is installed with MAMP, which is located at
/Applications/MAMP/bin/php/php5.4.10/bin
(MAMP 2.1.3)To do this, We need to edit the .bash_profile and add the MAMP version of PHP to the PATH variable.
Within the Terminal, run
vim ~/.bash_profile
Type i and then paste the following at the top of the file:
export PATH=/Applications/MAMP/bin/php/php7.1.22/bin:$PATH
Hit ESC, Type :wq, and hit EnterIn Terminal, run
source ~/.bash_profile
In Terminal, type in which php again and look for the updated string. If everything was successful, It should output the new path to MAMP PHP install.
In case it doesn't output the correct path, try closing the terminal window (exit fully) and open again, it should apply the changes (Restart in short).