Configuring Laravel and MongoDB extension for PHP (MAMP) - php

I'm trying to use MongoDB with Laravel and the jenssegers/mongodb composer package for Laravel.
In order to do that, I need to get install the MongoDB extension for PHP (I'm using MAMP). I have spent 4 hours trying to figure it out, but it doesn't work.
I have tried do add extension=mongodb.so in my php.ini file. But I keep getting this error when I'm running composer update:
- mongodb/mongodb 1.0.3 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system.
Any ideas what I can try next? I've been Googling a lot.

Related

PHP does not recognize an oci8 extension

I'm using
PHP version 7.4
windows 10
Laravel 5.7
I'm trying to perform a composer install on the repository, but the following error appears:
Problem 1
- Root composer.json requires yajra/laravel-oci8 5.7.* -> satisfiable by yajra/laravel-oci8[v5.7.0, ..., 5.7.x-dev].
- yajra/laravel-oci8[v5.7.0, ..., 5.7.x-dev] require ext-oci8 >=2.0.0 -> it is missing from your system. Install or enable PHP's oci8 extension.
I tried to follow the step by step of this post: Cannot install laravel oci8
But it still didn't work.
PHP OCI8 on PECL supports PHP 7 (and older versions - see
PECL page to install on older PHP versions).
Try uninstalling OCI8. Check if you don't have multiple versions of PHP - the difference in path names makes me think you have them.

Google Cloud App Engine Standard deployment with PHP 7.4 / 8.1 mongodb extension not working

I have already successfully deployed the app in php standard 7.4 environment and its running, today i wanted to update it and when i do gcloud app deploy i get:
Problem 1
- Root composer.json requires PHP extension ext-mongodb * but it is missing from your system. Install or enable PHP's mongodb extension.
Problem 2
- mongodb/mongodb is locked to version 1.4.0 and an update of this package was not requested.
- mongodb/mongodb 1.4.0 requires ext-mongodb ^1.5.0 -> it is missing from your system. Install or enable PHP's mongodb extension.
So i checked the php.ini file for the deployment, its in the root folder (same level as the yaml file) and contains:
extension=mongodb.so
extension=redis.so
extension=igbinary.so
Did i missed any google cloud update? I am wondering cause it does not complain about the version of the mongodb php extension and just says there is no extension?
I also tried to switch to PHP 8.1 runtime but i got the same error.
"provide" : {
"ext-mongo": "*"
},
i was able to fix it by adding this to my composer.json .. somehow i never needed it until today.
Worked for me adding to composer.json, so ext-mongodb instead of ext-mongo (I cannot comment on the answer of user1334817 )
"provide" : {
"ext-mongodb": "*"
}

How to install Cocorico?

I'm currently installing Cocorico an open source solution to create marketplaces for services.
My environment is Ubuntu 18.04, PHP 7.1, Apache 2, MySQL and MongoDB 4.
When i run composer install i have the following error:
Problem 1
- Installation request for alcaeus/mongo-php-adapter 1.1.3 -> satisfiable by alcaeus/mongo-php-adapter[1.1.3].
- alcaeus/mongo-php-adapter 1.1.3 requires ext-mongodb ^1.2.0 -> the requested PHP extension mongodb is missing from your system.
Problem 2
- Installation request for mongodb/mongodb 1.2.0 -> satisfiable by mongodb/mongodb[1.2.0].
- mongodb/mongodb 1.2.0 requires ext-mongodb ^1.3.0 -> the requested PHP extension mongodb is missing from your system.
It seems that php mongodb extension is missing. But i can see it in my php installed modules:
> php -m
...
mbstring
mongo
...
How can i make composer aware of the installed mongo PHP extension?
Thanks!
It is showing you have the mongo extension, which is apparently deprecated and should be mongodb. Check this out from the mongo docs:
The mongo extension available from PECL is an older, legacy driver for PHP 5.x. The mongo extension is no longer maintained and new projects are advised to use the mongodb extension and PHP library. A community-developed Mongo PHP Adapter project implements the legacy mongo extension’s API using the new mongodb extension and PHP library, which may be useful for those wishing to migrate existing applications.
Installation for mongodb extension per the PHP docs can be found here. It basically says to do this with PECL:
sudo pecl install mongodb
Then add extension=mongodb.so to your php.ini file.
Or you can try this (may vary depending on PHP version and PPA you are using):
sudo apt-get install php-mongodb
The easiest way to start with cocorico is withh docker.
https://github.com/Cocolabs-SAS/cocorico-docker

Laravel Composer require issue with Mac Sierra

I'm trying to include Laravel 5 Facade for Goutte in my application. However I am getting the following error:
Problem 1
- namshi/jose 5.0.2 requires lib-openssl * -> the requested linked library openssl has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- namshi/jose 5.0.2 requires lib-openssl * -> the requested linked library openssl has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- namshi/jose 5.0.2 requires lib-openssl * -> the requested linked library openssl has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- Installation request for namshi/jose (locked at 5.0.2) -> satisfiable by namshi/jose[5.0.2].
I have searched online and it suggests installing a new version of PHP and try using that instead however I have installed php56 via homebrew and its still not working. When i run:
which php
it says the path is:
/usr/bin/php
However brew installed PHP to:
/usr/local/Cellar/php56/5.6.30_6/bin
I have updated my .bash_profile with the following line:
export PATH=$PATH:/usr/local/Cellar/php56/5.6.30_6/bin
However even after restarting the terminal which php still returns /usr/bin/php.
You can try to create a symlink for new php version this way :
sudo ln /usr/local/Cellar/php56/5.6.30_6/bin/php /usr/local/bin/php
Then run your composer command
php composer require weidner/goutte
or
php composer.phar require weidner/goutte
Hope this helps !

yii framework: not able to install MongoDb extension for yii2

I want to use mongodb with yii framework for that i am trying to install mongodb extension. As per the documentation given at http://www.yiiframework.com/doc-2.0/ext-mongodb-index.html i have already added line ""yiisoft/yii2-mongodb": "~2.0.0"" in my composer.json file.
But whenever i issue command composer update to install this extension it gives me below error.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- yiisoft/yii2-mongodb 2.0.4 requires ext-mongo >=1.5.0 -> the requested PHP extension mongo is missing from your system.
- yiisoft/yii2-mongodb 2.0.3 requires ext-mongo >=1.5.0 -> the requested PHP extension mongo is missing from your system.
- yiisoft/yii2-mongodb 2.0.2 requires ext-mongo >=1.5.0 -> the requested PHP extension mongo is missing from your system.
I search a lot on this issue and found one solution here https://github.com/yiisoft/yii2-mongodb/issues/18 and here http://www.yiiframework.com/forum/index.php/topic/57726-solved-yii2-mongodb/ that suggest to add line extension=mongo.so in my /etc/php5/cli/php.ini file . but even after adding line to php.ini file command composer update still gives the same error.
Please help
I forgot to install mongodb php extension. after installing this extension it works. here is the link to install mongodb extension http://us1.php.net/manual/en/mongo.installation.php

Categories