Help With Migration

Hi There,

This is my 3rd Yii project to go live. so I am confident with the framework. (we are using mysql for the database).

However we are starting to make additional to a web portal we wrote in Yii. And need to add some database tables. This migration section looks like exactly what we need. The other developer i work with used something similar in rails and said that if we can get this yii migration tool working for us it will make rollouts a lot tidier, and I agree.

So i read the manual on the

We are running debian squeeze with the PDO extension installed. (i have confirmed this in 3 ways by doing a phpinfo() for apache, a php -i | grep pdo (for cli) and by running the yii requirements screen.

I am getting this error when trying to up the version:

Yii Migration Tool v1.0 (based on Yii v1.1.9-dev)

exception ‘CDbException’ with message ‘CDbConnection failed to open the DB connection: could not find driver’ in /var/www/yii/framework/db/CDbConnection.php:385

Stack trace:

#0 /var/www/yii/framework/db/CDbConnection.php(334): CDbConnection->open()

#1 /var/www/yii/framework/db/CDbConnection.php(312): CDbConnection->setActive(true)

#2 /var/www/yii/framework/base/CModule.php(391): CDbConnection->init()

#3 /var/www/yii/framework/cli/commands/MigrateCommand.php(417): CModule->getComponent(‘db’)

#4 /var/www/yii/framework/cli/commands/MigrateCommand.php(425): MigrateCommand->getDbConnection()

#5 /var/www/yii/framework/cli/commands/MigrateCommand.php(456): MigrateCommand->getMigrationHistory(-1)

#6 /var/www/yii/framework/cli/commands/MigrateCommand.php(75): MigrateCommand->getNewMigrations()

#7 [internal function]: MigrateCommand->actionUp(Array)

#8 /var/www/yii/framework/console/CConsoleCommand.php(141): ReflectionMethod->invokeArgs(Object(MigrateCommand), Array)

#9 /var/www/yii/framework/console/CConsoleCommandRunner.php(65): CConsoleCommand->run(Array)

#10 /var/www/yii/framework/console/CConsoleApplication.php(91): CConsoleCommandRunner->run(Array)

#11 /var/www/yii/framework/base/CApplication.php(162): CConsoleApplication->processRequest()

#12 /var/www/yii/framework/yiic.php(33): CApplication->run()

#13 /var/www/ezy_hq/protected/yiic.php(7): require_once(’/var/www/yii/fr…’)

#14 /var/www/ezy_hq/protected/yiic(4): require_once(’/var/www/ezy_hq…’)

I do understand that the php.ini is different for the CLI than apache2. But, the PDO is enabled in both, so i dont understand why this is not working.

Any help would be appreciated.

For CLI:

daryl@daryl-tc:/var/www/ezy_hq/protected$ php -i | grep pdo








PHP version Passed Yii Framework PHP 5.1.0 or higher is required.

$_SERVER variable Passed Yii Framework

Reflection extension Passed Yii Framework

PCRE extension Passed Yii Framework

SPL extension Passed Yii Framework

DOM extension Passed CHtmlPurifier, CWsdlGenerator

PDO extension Passed All DB-related classes

PDO SQLite extension Warning All DB-related classes This is required if you are using SQLite database.

PDO MySQL extension Passed All DB-related classes This is required if you are using MySQL database.

PDO PostgreSQL extension Warning All DB-related classes This is required if you are using PostgreSQL database.

Memcache extension Warning CMemCache

APC extension Warning CApcCache

Mcrypt extension Passed CSecurityManager This is required by encrypt and decrypt methods.

SOAP extension Passed CWebService, CWebServiceAction

GD extension with

FreeType support Passed CCaptchaAction

Ctype extension Passed CDateFormatter, CDateTimeParser, CTextHighlighter, CHtmlPurifier

Ok so supposedly all the command line stuff uses the settings in profile /protected/config/console.php instead of main.php

So remember if you plan to use migration you will need to have the database settings set here, as well as the database PDO installed.

You can use the commands i shared above. php -m works aswell from CLI to list the installed modules. Hope it saves someone else some time.