MongoDB PHP Driver Install (OS X El Capitan) - php

I've been wrestling with the MongoDB PHP Driver install for most of this afternoon.
I'm using PHP version 5.5, and I've installed the MongoDB PHP Driver using brew install php55-mongo (although I tried other methods before). The problem is, whenever I try to use MongoClient() I get the error:
Class 'MongoClient' not found
The module "mongo" is listed when I run php -m, but I also get the following warnings:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55/5.5.34/lib/php/extensions/no-debug-non-zts-20121212/mongo.so' - dlopen(/usr/local/Cellar/php55/5.5.34/lib/php/extensions/no-debug-non-zts-20121212/mongo.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55/5.5.34/lib/php/extensions/no-debug-non-zts-20121212/mongo.so' - dlopen(/usr/local/Cellar/php55/5.5.34/lib/php/extensions/no-debug-non-zts-20121212/mongo.so, 9): image not found in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php55-mongodb/mongodb.so' - dlopen(/usr/local/opt/php55-mongodb/mongodb.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php55-mongodb/mongodb.so' - dlopen(/usr/local/opt/php55-mongodb/mongodb.so, 9): image not found in Unknown on line 0
The module isn't listed when I use phpinfo() or get_loaded_extensions().
Any ideas?

Check which php mongo driver you have installed. It seems like you have installed new php mongo driver and for that you need to add mongodb.so extension instead of mongo.so also you
As reffered in PHP manual
The MongoClient class
(PECL mongo >=1.3.0)
Warning
This extension that defines this class is deprecated. Instead, the MongoDB extension should be used. Alternatives to this class include:
MongoDB\Driver\Manager

Related

OSX Big Sur unable to install php 7.4 intl

I am getting crazy since days as my new MacBook OS X Big Sur with php#7.4 is giving issues to XAMPP.
As far as I understood it's better to use the php from OS X than from XAMPP, but I am getting error while trying to install intl using brew. Here my code:
sudo pecl install intl
When I run the above I get this warning:
PHP Warning: PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/local/lib/php/pecl/20190902/intl (dlopen(/usr/local/lib/php/pecl/20190902/intl, 9): image not found), /usr/local/lib/php/pecl/20190902/intl.so (dlopen(/usr/local/lib/php/pecl/20190902/intl.so, 9): image not found)) in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/local/lib/php/pecl/20190902/intl (dlopen(/usr/local/lib/php/pecl/20190902/intl, 9): image not found), /usr/local/lib/php/pecl/20190902/intl.so (dlopen(/usr/local/lib/php/pecl/20190902/intl.so, 9): image not found)) in Unknown on line 0
downloading intl-3.0.0.tgz ..
then I am asked about path for ICU.
Specify where ICU libraries and headers can be found [DEFAULT] :
I press ENTER and I get this:
running: /private/tmp/pear/temp/intl/configure --with-php-config=/usr/local/opt/php#7.4/bin/php-config --with-icu-dir=DEFAULT
Then the installation starts, but at the end I get this error:
configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:
No package 'icu-uc' found
No package 'icu-io' found
No package 'icu-i18n' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables ICU_CFLAGS
and ICU_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
ERROR: `/private/tmp/pear/temp/intl/configure --with-php-config=/usr/local/opt/php#7.4/bin/php-config --with-icu-dir=DEFAULT' failed
If I make:
which php
I get:
/usr/local/opt/php#7.4/bin/php
Anyone able to give real solution?
thanks!

MongoDB extension not loading

When I install php mongodb extension on my windows, a warning is generated, however it works in CLI though. Would andyone give me any advice? Thanks!
PHP Warning: PHP Startup: Unable to load dynamic library
'd:/AppServ\\php5\\ext\\php_mongodb.dll' -
\xef\xbf\xbd\xd2\xb2\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd
\xd6\xb8\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd
\xc4\xa3\xef\xbf\xbd\xe9\xa1\xa3\r\n in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library mcrypt

I'm trying to build an app written in PHP (Laravel) from other devs, using Composer (I'm new to both).
I've installed mcrypt for PHP v5.5 with Homebrew (OSX 10.11) but every time I update my dependencies with "./composer.phar update" it returns me this error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55/5.5.33/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so' - dlopen(/usr/local/Cellar/php55/5.5.33/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so, 9): image not found in Unknown on line 0

PHP Startup: Unable to load dynamic library 'pdo-sqlite.so'

I found these issues after updating php5-sqlite (previously it was working fine) :
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/pdo_sqlite.so' - /usr/lib/php5/20131226/pdo_sqlite.so: undefined symbol: sqlite3_column_table_name in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/sqlite3.so' - /usr/lib/php5/20131226/sqlite3.so: undefined symbol: sqlite3_enable_load_extension in Unknown on line 0
p.s : so files exist
Details :
OS : Ubuntu 14.04 LTS
PHP : PHP 5.6.15
I have tried uninstalling (purge) and reinstalling PHP but the issues still remain.
I have tried commenting out extension=pdo-sqlite.so in /etc/php5/cli/conf.d/pdo_sqlite.ini, but it says "Driver not found".
Please help...
If you have built SQLite from source? Then, you forgot to enable Column metadata. Recompile SQLite with
CFLAGS="-DSQLITE_ENABLE_COLUMN_METADATA=1" ./configure
make
sudo make install
Have fun using the cutting edge SQLite.
Reference - https://www.sqlite.org/compile.html#enable_column_metadata

where is php phalcon's config?

I installed phalcon follow it's Compilation document , the command showed that I install and build succeed. But when I run config script <?php print_r(get_loaded_extensions()); ?> it reported error:
PHP Warning: PHP Startup: Unable to load dynamic library '##HOMEBREW_PREFIX##/opt/php55-phalcon/phalcon.so' - dlopen(##HOMEBREW_PREFIX##/opt/php55-phalcon/phalcon.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '##HOMEBREW_PREFIX##/opt/php55-phalcon/phalcon.so' - dlopen(##HOMEBREW_PREFIX##/opt/php55-phalcon/phalcon.so, 9): image not found in Unknown on line 0
locate shows that there are two phalcon.so, the first was installed by phalcon's install sctipt, the second was installed by brew install php5x php5x-phalcon
/usr/local/Cellar/php55/5.5.27_2/lib/php/extensions/no-debug-non-zts-20121212/phalcon.so
/usr/local/Cellar/php55-phalcon/2.0.6/phalcon.so
I don't know where is the phalcon's config, maybe it found phalcon.so from the wrong place.
How to fix it?
edit:
I found the phalcon's config file and change the path of phalcon.so, and the error still there.
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55-phalcon/2.1.6/phalcon.so' - dlopen(/usr/local/Cellar/php55-phalcon/2.1.6/phalcon.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55-phalcon/2.1.6/phalcon.so' - dlopen(/usr/local/Cellar/php55-phalcon/2.1.6/phalcon.so, 9): image not found in Unknown on line 0

Categories