Updating php mongo on Yum - php

I'm trying to update from PHP 5.6 to PHP 7 on my Vagrant machine. I'm more or less following this guide https://blog.remirepo.net/post/2017/12/04/Install-PHP-7.2-on-CentOS-RHEL-or-Fedora
I've done the following:
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
I follow the regular steps for activating the packages, but then when I try to update through
yum update
I get the following error:
php-pecl-mongo-1.6.16-1.el7.remi.5.6.x86_64 (#remi-php56)
Requires: php(api) = 20131106-64
Removing: php-common-5.6.36-1.el7.remi.x86_64 (#remi-php56)
The error is actually longer. But in short, it indicates that the I need the Mongo Driver for PHP 7.
How can I update this though? I'm at loss!

The mongo extension is only for PHP 5.
The mongodb extension is for PHP 5.5+ and PHP 7+
So yum blocks the transaction (expected) as one of the installed extension is not compatible with PHP 7.
You have to remove this extension before the upgrade.
Be aware than mongodb and mongo are really different extensions, with very different API.
Usually people use the mongodb/mongodb library to have a high level API
You can also consider using alcaeus/mongo-php-adapter library which provides the old mongo API using mongodb extension.

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

PECL install with --configureoptions not working - Memcache

Lately, I have been trying to install the pecl memcache PHP extension on OSX Catalina with brew memcached installed and I'm getting the following error every time I try the install process:
configure: error: memcache support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located
I have tried with pecl install memcache and with pecl install --configureoptions='with-zlib-dir="path"' memcache to no avail. It always gets the same point and it fails.
From what I have reviewed on different topics regarding the installation of the package the issue seems to be with the -D option in the pecl install command, because when I do a manual install from the source code passing the argument --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11 to the ./configure command it works like a charm and installs the package but is now not listed in pecl list installed packages and as so it cannot be uninstalled.
The issue is I need pecl to manage the installation of the package to be able to uninstall it any time when the environment changes from project to protect.
A quick fix for this (found via https://bugs.php.net/bug.php?id=56522) is to use the PHP_ZLIB_DIR variable instead of --with-zlib-dir.
i.e. PHP_ZLIB_DIR=/usr/local/Cellar/zlib/1.2.11 pecl install memcache
I've struggled with the -D option before as well - near as I can tell it's completely broken.

Error on installing XDebug 2.9.0 on Vagrant

I'm currently attempting to upgrade Xdebug 2.8.1 to 2.9.0 in order to resolve performance issues on code coverage report generation as reported in https://bugs.xdebug.org/view.php?id=1717.
My system is Ubuntu 19.10, running a Vagrant VM with Debian GNU/Linux 9 (stretch). The VM has multiple versions of PHP running, to support multiple applications on our stack. Those versions are 5.6, 7.0, 7.1, 7.2, 7.3, and 7.4.
The only version of Xdebug available through apt is version 2.8.1, so I've attempted the following methods:
Using Pecl, with apt-get install php-dev, pecl channel-update pecl.php.net, and pecl install xdebug.
Using the Xdebug wizard at https://xdebug.org/wizard, which has instructions for manually unpacking the .tgz file, compiling the xdebug.so, and placing it in the correct folder.
However, in both of these methods, when adding zend_extension=/path/to/xdebug.so to the appropriate php.ini file and restarting the web server, I'm given the following error: Failed loading /usr/lib/php/20180731/xdebug.so: /usr/lib/php/20180731/xdebug.so: undefined symbol: zend_post_startup_cb.
Can anyone provide further guidance?
I've found the solution to the problem.
When installing php-dev the package selected at the time of this writing is for PHP 7.3, when the server's default PHP version is 7.1. By installing php7.1-dev I was able to perform the install using either of the above processes without issue.

Can not connect to MongoDB from PHP

I have installed MongoDB PHP lib
but despite this I can't connect to MongoDB database
Error of rockmonogo :
To make things right, you must install php_mongo module. Here for installation documents on PHP.net.
Error of phpmoadmin :
PHP cannot access MongoDB, you need to install the Mongo extension for PHP.
Error of Laravel with Jenssegers\Mongodb lib :
Unsupported driver [mongodb]
Make sure that it is in fact properly installed. The errors you're getting seem to indicate that your environment can't find the extension. I've compiled installation instructions for you.
Unix-like Systems
Open a terminal emulator and run wget http://pear.php.net/go-pear.phar
Then start the installation of PECL with php go-pear.phar
Install the PHP MongoDB extension sudo pecl install mongodb.
Add extension=mongodb.so to the php.ini file.
Mac OS X
Install homebrew by running /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" in a terminal.
Run brew update
Run brew tap homebrew/php
Install the extension according to your PHP version.
PHP 5.4: brew install php54-mongodb
PHP 5.5: brew install php55-mongodb
PHP 5.6: brew install php56-mongodb
PHP 7.0: brew install php70-mongodb
Windows
Open your web browser to http://pecl.php.net/package/mongodb
Open the latest version from the DLL link (with the Windows icon).
Choose the appropriate version from the DLL list. They are sorted by PHP version, system architecture (i.e. 32-bit vs 64-bit), and thread safety.
Extract the downloaded archive and place php_mongodb.dll in your PHP extensions directory.
Add extension=php_mongodb.dll to the php.ini file.
For mac system, the homebrew php tap mechanism is deprecated and it won't work. You need to manually install it or you need to install Ampps which contains all the packages in built.
The following error might be thrown for the user with new version of the system
Error: homebrew/php was deprecated. This tap is now empty as all its formulae were migrated.

installing php-devel on RHEL6 (PHP 5.3.3)

I'm trying in vain to get the php oci_* extensions installed on our server, but i've hit a brick wall.
So far i've done this:
Installed oracle basic & devel libraries (v10.2)
Installed php-pear package
Now I'm trying to install oci8 using "pecl install oci8" but I get an error message about "phpize" command not being found.
My googling tells me that that is caused by "php-devel" not being installed, so i tried various different yum searches, e.g. "yum search php-devel", "yum search php5-devel", "yum search php-dev", etc... none of which could find anything.
I eventually found a repository hosted by "utterramblings" which had php-devel. So, now when I do a yum search using that repository, it can find "php-devel":
php-devel.i386 : Files needed for building PHP extensions
But when I try to install it I get this:
Error: Package: php-devel-5.2.17-jason.2.i386 (utterramblings)
Requires: php = 5.2.17-jason.2
Installed: php-5.3.3-14.el6_3.i686 (#rhel-i386-server-6)
php = 5.3.3-14.el6_3
Available: php-5.2.13-jason.1.i386 (utterramblings)
php = 5.2.13-jason.1
Available: php-5.2.14-jason.1.i386 (utterramblings)
php = 5.2.14-jason.1
Available: php-5.2.16-jason.1.i386 (utterramblings)
php = 5.2.16-jason.1
Available: php-5.2.17-jason.2.i386 (utterramblings)
php = 5.2.17-jason.2
Available: php-5.3.2-6.el6.i686 (rhel-i386-server-6)
php = 5.3.2-6.el6
Available: php-5.3.2-6.el6_0.1.i686 (rhel-i386-server-6)
php = 5.3.2-6.el6_0.1
Available: php-5.3.3-3.el6.i686 (rhel-i386-server-6)
php = 5.3.3-3.el6
Available: php-5.3.3-3.el6_1.3.i686 (rhel-i386-server-6)
php = 5.3.3-3.el6_1.3
Available: php-5.3.3-3.el6_2.5.i686 (rhel-i386-server-6)
php = 5.3.3-3.el6_2.5
Available: php-5.3.3-3.el6_2.6.i686 (rhel-i386-server-6)
php = 5.3.3-3.el6_2.6
Available: php-5.3.3-3.el6_2.8.i686 (rhel-i386-server-6)
php = 5.3.3-3.el6_2.8
And to be honest, i'm not sure how to resolve that, presumably it has something to do with the version of php we have installed, but i'm not sure what I need to do to fix it.
These are our details:
Red Hat Enterprise Linux Server release 6.1 (Santiago) [32bit]
PHP 5.3.3
Could anyone please advise me as to either:
a) what I need to do to resolve that issue and get php-devel installed from that repo
OR
b) point me in the direction of another repo which will allow me to easily install php-devel for our server
Thank you.
Managed to get it installed eventually.
To quickly detail what I did for any future viewers, I ran:
yum list installed
To find out what exact package of php we had installed (5.5.3-14.el6_3 I think or something like that).
Then searched for the relevant php-devel package to match that php package version on rpm.pbone.net.
Tried to install that and failed with a "failed depencies" error "automake needed to install php-devel".
Ran:
yum install automake
Then tried to installed the package again:
rpm -Uvh URLOFPACKAGE
It installed correctly, then ran:
pecl install oci8
And followed the instructions.
Restarted httpd service and done.

Categories