php –version
If php is not set, then set the PHP path
sudo pecl install mongodb -> Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script. ERROR: `phpize’ failed -> brew install autoconf
sudo pecl install mongodb -> fatal error: ‘unicode/usprep.h’ file not found #include <unicode/usprep.h> ^~~~~~~~~~~~~~~~~~ 1 error generated. make: *** [src/libmongoc/src/libmongoc/src/mongoc/mongoc-scram.lo] Error 1 ERROR: `make’ failed -> brew install icu4c -> I already have the ICU library installed. -> export PKG_CONFIG_PATH=”/usr/local/opt/icu4c/lib/pkgconfig” -> sudo pecl install mongodb
export CFLAGS=”-I/usr/local/opt/icu4c/include”
export CPPFLAGS=”-I/usr/local/opt/icu4c/include”
export LDFLAGS=”-L/usr/local/opt/icu4c/lib”
brew install pkg-config
pkg-config --cflags icu-uc
brew install icu4c
brew link icu4c –force
$ git clone https://github.com/mongodb/mongo-php-driver.git
$ cd mongo-php-driver
$ git submodule update –init
$ phpize
$ ./configure
$ make all
$ sudo make install
pecl install mongodb
brew update
brew upgrade icu4c
pecl install -f mongodb
brew tap-new $USER/local-tap
brew extract –version=68.2 icu4c $USER/local-tap
brew install icu4c@68.2
brew link –overwrite –force icu4c@68.2
pecl install -f mongodb
Build process completed successfully
Installing ‘/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/mongodb.so’
install ok: channel://pecl.php.net/mongodb-1.15.2
configuration option “php_ini” is not set to php.ini location
You should add “extension=mongodb.so” to php.ini
pear config-set php_ini /Applications/XAMPP/xamppfiles/etc/php.ini
extension=mongodb.so in PHP ini
/Applications/XAMPP/xamppfiles/etc/php.ini at the end of the file
php -i | grep mongodb
PHP Warning: PHP Startup: Unable to load dynamic library ‘mongodb.so’ (tried: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/mongodb.so (dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/mongodb.so, 0x0009): symbol not found in flat namespace ‘_u_strFromUTF8_72’), /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/mongodb.so.so (dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/mongodb.so.so, 0x0009): tried: ‘/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/mongodb.so.so’ (no such file), ‘/System/Volumes/Preboot/Cryptexes/OS/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/mongodb.so.so’ (no such file), ‘/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/mongodb.so.so’ (no such file))) in Unknown on line 0
it works