How Tos > General
Install a PHP extension using PECL
Use the following guideline to compile your own extensions. This example uses the mongodb extension and PHP 7.0.15. You can find more PHP extensions here.
- Check the “Make this version available on the command line” check box on your Languages > PHP tab.
- Restart your servers. A PECL alias now exists in your “~/.profile” file.
- Open Terminal.app (/Applications/Utilities) change the directory to /Applications/MAMP/bin/php/php[Version]/bin and enter the following line into the terminal and hit enter:
pecl install mongodb
Your extension should now build and you should see the following result. - A mongodb.so extension should now be in your “/Applications/MAMP/bin/php/php7.0.15/lib/php/extension/no-debug-non-zts” folder.
- Go to File > Edit Templates > PHP > PHP7.0.15 and add extension=mongodb.so.
- Restart your servers and verify the extension has been loaded by checking phpInfo.