mongodb php-driver : php startup error - php

I installed mongodb php-driver as per the guideline shown here:
https://github.com/mongodb/mongo-php-driver
But when I run #php command its showing following error :
Warning: PHP Startup: Unable to load dynamic library
'/opt/lampp/lib/php/extensions/no-debug-non-zts-20151012/mongodb.so' -
/opt/lampp/lib/php/extensions/no-debug-non-zts-20151012/mongodb.so: symbol
CRYPTO_get_locking_callback, version OPENSSL_1.0.0 not defined in file
libcrypto.so.1.0.0 with link time reference in Unknown on line 0
I am using :
Lampp Stack
PHP : 7.0.0
OS: Ubuntu 15.10
Pear: 1.10.1
Please suggest any solution if you have. Thanks in advance .

It looks like you don't have SSL library enabled/installed correctly on your system. Most likely, I am thinking you don't have the libssl-dev package installed.
You should install this with apt-get install libssl-dev libsasl2-dev, and then reinstall the mongodb extension with pecl uninstall mongodb && pecl install mongodb.

Related

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
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/extensins/mongodb#8.1

Does the Redis PHP extension installed through PECL work on Mac M1?

The Redis server is running successfully using Homebrew with brew services start redis.
The PECL Redis installer appears to work with sudo pecl install redis , giving the following output:
Build process completed successfully
Installing '/opt/homebrew/Cellar/php#7.4/7.4.28/pecl/20190902/redis.so'
install ok: channel://pecl.php.net/redis-5.3.7
Extension redis enabled in php.ini
If I use php --ini, this is the output:
Warning: PHP Startup: Unable to load dynamic library 'redis.so' (tried: /opt/homebrew/lib/php/pecl/20190902/redis.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/redis.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20190902/redis.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/redis.so' (no such file), '/usr/lib/redis.so' (no such file)), /opt/homebrew/lib/php/pecl/20190902/redis.so.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/redis.so.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20190902/redis.so.so' (no such file), '/usr/local/lib/redis.so.so' (no such file), '/usr/lib/redis.so.so' (no such file))) in Unknown on line 0
The redis.so library is in /opt/homebrew/lib/php/pecl/20190902.
Is there any way to get this library working on Mac M1?
You can run pecl with arch to ensure that the architecture is arm64.
arch -arm64 sudo pecl install redis
Alternatively, you can use a brew tap I maintain (shivammathur/extensions).
brew tap shivammathur/extensions
brew install redis#7.4
I had the same problem.
Basically, I have done the same like accepted answer
arch -arm64 sudo pecl install redis
But that didn't work for me immediately. I needed to reinstall redis.
pecl uninstall redis
pecl install redis
And after that it finally worked. I hope that it will help somebody, I spent on this problem few hours.

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/mysql.so'

I recently installed EHCP with all the necessary packages and now everytime I try to run my laravel project by typing php artisan serve, I get the following error:
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php/20151012/mysql.so' - /usr/lib/php/20151012/mysql.so:
cannot open shared object file: No such file or directory in Unknown
on line 0
Please help, thank you.
Do you have the mysql extension installed? If not, you may need to install it.
apt-get install php-mysql
In ubuntu 16.04 and above (as I can remember), this will install the module for PHP7 by default. So you need to check your php version and install the relevant one.
Ex: apt-get install php5.6-mysql
Then check you have the module installed by running:
php -m | grep mysql
Hope it helps!

PHP: Unable to load dynamic library intl.so (OSX)

I am trying to run a CakePHP app. I've been working for a while in this app and recently I had to install a new dependency (using composer). Once I installed it this error came up and I can't run the app anymore:
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20121212/intl.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/intl.so, 9): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.56.dylib
Referenced from: /usr/lib/php/extensions/no-debug-non-zts-20121212/intl.so Reason: image not found in Unknown on line 0
When I open that folder I can see a different version of that library:
libicui18n.57.dylib
But the system is looking for
libicui18n.56.dylib
How can I install the 56 version of that library or upgrade the intl so it uses version 57?
Is that what I need to do?
Thanks!!
I have the same question when i upgrade node to v8.x.
After i run brew upgrade node,the icu4c was updated.
I solve the problem by under command:
brew unlink php56-intl
brew remove php56-intl
brew install php56-intl
so, i feel you should reinstall intl extension.

Install libssh2-php on PHP 5.4.9 (x64)

I have a problem with the update on php 5.4.9 (i install it with the ppa "ppa:ondrej/php5")
Now i have the problem that i can't install libssh2-php (which is required on my project)
I found some .deb files, but it's only for 32-bit systems.
So when i'm trying to install libssh2-php i have a collision with "libssh2-php:i386" and i have the following dependiesmessage:
ucf:i386 libc6:i386 (>= 2.4) libssh2-1:i386 (>= 1.0) and phpapi-20090626+lfs:i386
System: Ubuntu Server 12.04 LTS x64 | PHP 5.4.9
I also got a warning on running "php -v"
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/ssh2.so' - /usr/lib/php5/20100525/ssh2.so: cannot open shared object file: No such file or directory in Unknown on line 0
The problem is/was that the libssh2 is not aviable for PHP5.4.x AND a x64 system.
I have the same problem trying to use ondrej's ppa for ubuntu 10.04 LTS. It seams that he didn't include the sssh extension.
Apt-get tries to install the version from default package which runs into conflict (depends phpapi-20090626+lfs) with current installed version, isn't it?
Only my backup php cli script needs this extension to run. After trying to solve dependencies witout success, I switched to a shell_exec('ssh ...#...') solution as workaround.
I am only a developer with advanced admin knowledge, no apt-get or linux packaging admin professional. There maybe other solution to fix this via packaging management or maybe building the needed version from source?
EDIT:
There will be another nicer solution :-) you can use pecl to install / build the extension, here is what i have done:
$ sudo pecl install ssh2
Failed to download pecl/ssh2 within preferred state "stable", latest release is version 0.12, stability "beta", use "channel://pecl.php.net/ssh2-0.12" to install
install failed
$ sudo pecl install channel://pecl.php.net/ssh2-0.12
downloading ssh2-0.12.tgz ...
Starting to download ssh2-0.12.tgz (26,223 bytes)
[...]
Build process completed successfully
Installing '/usr/lib/php5/20100525+lfs/ssh2.so'
install ok: channel://pecl.php.net/ssh2-0.12
configuration option "php_ini" is not set to php.ini location
You should add "extension=ssh2.so" to php.ini
Afterwards I add extension=/usr/lib/php5/20100525+lfs/ssh2.so to php config.
Just do:
sudo aptitude purge php5-suhosin
It's described in detail here: bugs.debian.org

Categories