-1

I am new with YII 2.0 and i have installed new PHP7.0.2 Version, i was successfully installed the YII2.0 via composer and i enabled my gii code creation.

So that now i want to create a model file for my table users, when i click the model creation via gii page, it showing the "Database Exception – yii\db\Exception".

Can you please suggest your answer for rectify this problem.

senthil
  • 324
  • 2
  • 15
  • 1
    Refer: http://www.oneminuteinfo.com/2015/07/yii-cdbexception-could-not-find-driver.html and http://stackoverflow.com/questions/30155033/exception-could-not-find-driver-while-migration-in-yii2 and http://www.yiiframework.com/forum/index.php/topic/2785-db-connection-could-not-find-driver/ and https://github.com/robregonm/yii2-auth/issues/32 –  Feb 04 '16 at 10:36
  • Thanks for your answer, from your first link itself i got my the solution for my problem, – senthil Feb 04 '16 at 10:51
  • i guys,in yii2.0 we already have a model file "user.php" in yii2.0 core , so there is no need to create once again the same file. – senthil Jun 10 '16 at 12:11

1 Answers1

1

The db.php configuration file must define db which looks like the following:

'db'=>array(
    'connectionString' => 'mysql:host=localhost;dbname=myDb',
    'emulatePrepare' => true,
    'username' => 'root',
    'password' => 'rootPassword',
    'charset' => 'utf8',
),

OR

Edit php.ini to enable each MySQL-related extension such as the following:

extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo_mysql.dll