sfbrz
sfbrz

Reputation: 13

PHP 8.1 - Mac M1 - brew - MongoDB error "symbol not found in flat namespace '_u_strFromUTF8_67'"

I'm facing this error

PHP Warning:  PHP Startup: Unable to load dynamic library 'mongodb.so' (tried: /opt/homebrew/lib/php/pecl/20210902/mongodb.so (dlopen(/opt/homebrew/lib/php/pecl/20210902/mongodb.so, 0x0009): symbol not found in flat namespace '_u_strFromUTF8_67'), /opt/homebrew/lib/php/pecl/20210902/mongodb.so.so (dlopen(/opt/homebrew/lib/php/pecl/20210902/mongodb.so.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20210902/mongodb.so.so' (no such file))) in Unknown on line 0

I'm on on Mac with Apple Silicon, php 8.1 installed with "brew tap shivammathur/php". I'm trying to use php with mongodb, installed with "pecl install mongodb". When I add extension=mongodb.so or extension="mongodb.so" to my php.ini, I receive this error.

I try to follow another post with a similar error, but with no different result. "symbol not found in flat namespace '_PHP_MD5Init' " Error encountered in loading redis dynamic library

The same approach I used to install xdebug and no problem occoured.

Any help? What I missed?

Just for info, pecl list print out:

Package Version State
mongodb 1.14.2  stable

Other things maybe can be useful:

macOs 12.6
php 8.1.11
mongodb 1.14.2
mongocli 1.27.0

Xdebug is also installed by pecl and it works, so I guess it must be something wrong with mongodb's package or something

Upvotes: 1

Views: 1655

Answers (1)

Shivam Mathur
Shivam Mathur

Reputation: 2703

You compiled mongodb with icu4c 67.1 as dependency and brew most likely updated it.

To fix this make sure icu4c is the latest version and compile the MongoDB extension again.

brew update
brew upgrade icu4c
pecl install -f mongodb

Alternatively, you can remove the extension installed using pecl and use the homebrew tap I maintain. https://github.com/shivammathur/homebrew-extensions

pecl uninstall mongodb
brew tap shivammathur/extensions
brew install shivammathur/extensions/[email protected]

Upvotes: 0

Related Questions