Yii Framework Forum: Console Application Error - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Console Application Error Rate Topic: -----

#1 User is offline   pcs2112 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 79
  • Joined: 31-July 10

Posted 27 October 2011 - 12:41 AM

Hi GUys,

I'm having a weird error thrown in a console application

here is my config file

return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

	// preloading 'log' component
	'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
	),
	
	// application components
	'components'=>array(
		'db' => array(
			'class' => 'CDbConnection',
			'connectionString' => 'mysql:host=localhost;dbname=xxx',
			'username' => 'xx',
			'password' => 'xx',
			'charset' => 'UTF8',
			'emulatePrepare' => true,
			'enableParamLogging' => true,
			'tablePrefix' => ''
		),
		'log' => array(
			'class' => 'CLogRouter',
			'routes' => array(
				array(
					'class'=>'CFileLogRoute',
					'levels' => 'error, warning',
				),
			),
		),
		
	),
	
);


here is the command and the stack trace

php yiic.php cmpreport index --id = 99

exception 'CDbException' with message 'CDbConnection failed to open the DB connection: could not find driver' in /var/yii-1.1.8.r3324/framework/db/CDbConnection.php:364
Stack trace:
#0 /var/yii-1.1.8.r3324/framework/db/CDbConnection.php(313): CDbConnection->open()
#1 /var/yii-1.1.8.r3324/framework/db/CDbConnection.php(291): CDbConnection->setActive(true)
#2 /var/yii-1.1.8.r3324/framework/base/CModule.php(372): CDbConnection->init()
#3 /var/yii-1.1.8.r3324/framework/base/CApplication.php(429): CModule->getComponent('db')
#4 /var/yii-1.1.8.r3324/framework/db/ar/CActiveRecord.php(609): CApplication->getDb()
#5 /var/yii-1.1.8.r3324/framework/db/ar/CActiveRecord.php(2275): CActiveRecord->getDbConnection()
#6 /var/yii-1.1.8.r3324/framework/db/ar/CActiveRecord.php(372): CActiveRecordMetaData->__construct(Object(CsvCompareImport))
#7 /var/www/dev2.nutritionix/protected/modules/menuAdmin/models/CsvCompareImport.php(37): CActiveRecord::model('CsvCompareImpor...')
#8 /var/www/dev2.nutritionix/protected/commands/CmpReportCommand.php(8): CsvCompareImport::model()
#9 [internal function]: CmpReportCommand->actionIndex(true)
#10 /var/yii-1.1.8.r3324/framework/console/CConsoleCommand.php(135): ReflectionMethod->invokeArgs(Object(CmpReportCommand), Array)
#11 /var/yii-1.1.8.r3324/framework/console/CConsoleCommandRunner.php(63): CConsoleCommand->run(Array)
#12 /var/yii-1.1.8.r3324/framework/console/CConsoleApplication.php(88): CConsoleCommandRunner->run(Array)
#13 /var/yii-1.1.8.r3324/framework/base/CApplication.php(158): CConsoleApplication->processRequest()
#14 /var/yii-1.1.8.r3324/framework/yiic.php(33): CApplication->run()
#15 /var/www/dev2.nutritionix/protected/yiic.php(24): require_once('/var/yii-1.1.8....')



The weird thing is that it works on my development windows machine. My production server is Linux, does anybody know what could the problem be?
0

#2 User is offline   marco@sms 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 30
  • Joined: 08-August 11
  • Location:Hamburg, Germany

Posted 27 October 2011 - 02:03 AM

PHP modules can be defined for cli and apache seperately. Make sure you have mysql enabled!

Call

php -B "phpinfo();" | grep mysql

0

#3 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,353
  • Joined: 12-October 09
  • Location:Croatia

Posted 27 October 2011 - 03:49 AM

First thing to check on new servers are the Yii requirements - http://www.yiiframew...on#requirements
Find more about me.... btw. Do you know your WAN IP?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users