Upgrade Mongodb Extension Version - Laravel Project

Author - Webner
11.03.2020
|
0 Comments
||

mongodb extension

Issue while upgrading Mongodb extension version:

I have upgraded laravel version from 5.7 to laravel version 6.5. Now, I’m getting mongodb extension version error while updating composer. Error given below:

ERROR: jenssegers/mongodb v3.6.0 requires mongodb/mongodb ^1.4 -> satisfiable by mongodb/mongodb[1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.5.0, 1.5.1, 1.6.x-dev, v1.4.x-dev, v1.5.x-dev].

Solution to upgrade extension version:

First of all, check your installed extension and install the library’s latest version.
:~$ php --ri mongodb | grep version

OutPut:

MongoDB extension version => 1.4.0
libbson bundled version => 1.8.1
libmongoc bundled version => 1.8.1

Before the up-gradation of the extension version, you need to install the php{x}-dev dependency package, which will automatically install the correct version of php-dev for your distribution. I have mentioned the complete command below:
:~$ sudo apt-get install php7.2-dev
Restart the apache server.
:~$ sudo /etc/init.d/apache2 restart
OR
:~$ sudo service apache2 restart
Now upgrade the extension version with the help of the PECL repository. This command will upgrade the extension and required libraries.
:~$ sudo pecl upgrade mongodb
Now check again upgraded extension and libraries version.
:~$ php --ri mongodb | grep version

OutPut:

MongoDB extension version => 1.6.0
libbson bundled version => 1.15.1
libmongoc bundled version => 1.15.1

Now, run the following command from your project root to update all the dependencies of your project.
:~$ composer update

Which command is used to check version of the installed extension?

The following command is used to check the version of the installed extension: :~$ php --ri mongodb | grep version

What is the command for installing the php{x}-dev dependency package?

Following is the command for installing the php{x}-dev dependency package: :~$ sudo apt-get install php7.2-dev

How can we restart the Apache server?

We can restart the Apache server using the following command: :~$ sudo /etc/init.d/apache2 restart

How can we update all the dependencies of a project?

We can update all the dependencies of a project by running the following command from the project root: :~$ composer update

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *