This article takes mongodb extension as an example.
System: MacOS 10.12.6
Installation steps:
1. Download the expansion package
2. Preparation Working (please skip this step if autoconf and openssl are already installed):
brew install autoconf brew install openssl echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile export LDFLAGS="-L/usr/local/opt/openssl/lib" export CPPFLAGS="-I/usr/local/opt/openssl/include"
3. Unzip and enter:
/Applications/MxSrvs/bin/php/bin/phpize ./configure --with-php-config=/Applications/MxSrvs/bin/php/bin/php-config --with-openssl-dir=/usr/local/Cellar/openssl/1.0.2r make && make install
4. Edit php.ini and add the mongodb extension in the extension area
extension=/Applications/MxSrvs/bin/php/lib/php/extensions/no-debug-non-zts-20131226/mongo.so
5. View phpinfo()
Recommended tutorial: PHP video tutorial
The above is the detailed content of How to install extensions for PHP that comes with Mac. For more information, please follow other related articles on the PHP Chinese website!