4

I have just added this code in app\common\config\main.php

<?php
return [
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'components' => [
    'cache' => [
        'class' => 'yii\caching\FileCache',
    ],
],

'modules' => [
//...
'gii1' => [
    'class' => 'yii\gii\Module',
        'generators' => [
            'mongoDbModel' => [
                'class' => 'yii\mongodb\gii\model\Generator'
                ]
                    ],
                        ],
                            ],

];

but when I run php composer.phar require --prefer-dist yiisoft/yii2-mongodb the result came like this enter image description here

what should I do?

riariashn
  • 73
  • 5

1 Answers1

0

Check if there is the line

extension=php_mongo.dll

in your php.ini file uncommented (without ; at the beginning). Also check if there is another php.ini with the same (there are usually two configurations, one for CGI and one for CLI).

If you can not find this you need to install MongoDB PHP driver first.

Bizley
  • 17,392
  • 5
  • 49
  • 59
  • I have installed mongodb php driver. then i check "php_mongo.dll" extension in php.ini but there's nothing. I run php composer.phar require --prefer-dist yiisoft/yii2-mongodb again, but still not working. what should I do? – riariashn Aug 10 '16 at 08:23
  • add the missing line and restart php – Bizley Aug 10 '16 at 09:17