Yiic Mysql Isn't Working

I’m trying to learn Yii and currently am reading a book on it. My problem is that I can’t seem to connect to mysql via yiic (it’s working fine via browser).

The following is the error log:

my mysql configuration in console.php is the same as in main.php


'db'=>array(

                        'connectionString' => 'mysql:host=localhost;dbname=trackstar',

                        'emulatePrepare' => true,

                        'username' => 'root',

                        'password' => '',

                        'charset' => 'utf8',

                ),

For whatever reason it doesn’t want to work. Does anyone know how to fix this?

P.S. I posted this same question in “Web Application Development With Yii And PHP” but no one replied. I’m only double posting in hopes that more people are reading this section and the problem will go away sooner.

Thanks for the help in advance.

I notice you have framework in a different folder.

In your application you may need to change the path in protected/yiic.php or use yiic from the framework folder.

Here’s what it looks like.


// change the following paths if necessary

$yiic=dirname(__FILE__).'/../framework/yiic.php';

$config=dirname(__FILE__).'/config/console.php';


require_once($yiic);

Sadly that didn’t help. It points to correct location.

This is the content of yiic.php:


<?php


// change the following paths if necessary

$yiic=dirname(__FILE__).'/../../yii/framework/yiic.php';

$config=dirname(__FILE__).'/config/console.php';


require_once($yiic);

Edit: I guess yiic was reading different php install on my system. I removed system path to my old php installation and it works now.