Home  >  Article  >  Backend Development  >  How to install extensions for PHP that comes with Mac

How to install extensions for PHP that comes with Mac

王林
王林Original
2019-10-21 15:43:337881browse

How to install extensions for PHP that comes with Mac

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

How to install extensions for PHP that comes with Mac

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()

How to install extensions for PHP that comes with Mac

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn