gii CDbException

I am trying to create a simple web application using yii. I have install WAMP and yii. I am also created a skeleton application called yii test. I have also created a database with mysql called yiitest which has a table called persons and has the following columns: pid, fname, lname, dob, zip. I am trying to build the basic functionality of the web app using gii. I can log into gii and navigate to Controller Generator Form Generator and Module Generator, but when I try to click on Crud Generator or Model Generator I get a CDbException error.

Here is my code:



// This is the database connection configuration.

return array(

	//'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',

	// uncomment the following lines to use a MySQL database


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

	'emulatePrepare' => true,

	'username' => 'yiiUser',

	'password' => 'p4ssw0rd',

	'charset' => 'utf8',





// uncomment the following to define a path alias

// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable

// CWebApplication properties can be configured here.

return array(


	'name'=>'My Web Application',

	// preloading 'log' component


	// autoloading model and component classes






		// uncomment the following to enable the Gii tool




			// If removed, Gii defaults to localhost only. Edit carefully to taste.





	// application components



			// enable cookie-based authentication



		// uncomment the following to enable URLs in path-format











		// database settings are configured in database.php



			// use 'site/error' action to display errors








					'levels'=>'error, warning',


				// uncomment the following to show log messages on web pages









	// application-level parameters that can be accessed

	// using Yii::app()->params['paramName']


		// this is used in contact page




Any help on getting gii’s Model Generator and Crud Generator working would be very helpful!

The configuration looks fine to me, but what error message do you get exactly?

Thanks for your response! This is a straight copy from the page. Also I have attached a picture



48 ));

49 }


51 public function requiredTemplates()

52 {

53 return array(

54 ‘model.php’,

55 );

56 }


58 public function init()

59 {

60 if(Yii::app()->{$this->connectionId}===null)

61 throw new CHttpException(500,‘A valid database connection is required to run this generator.’);

62 $this->tablePrefix=Yii::app()->{$this->connectionId}->tablePrefix;

63 parent::init();

64 }


66 public function prepare()

67 {

68 if(($pos=strrpos($this->tableName,’.’))!==false)

69 {

70 $schema=substr($this->tableName,0,$pos);

71 $tableName=substr($this->tableName,$pos+1);

72 }

The database connection is not established.

Are you sure you have installed php_pdo and php_pdo_mysql?