Error Deploying Yii Framework Website On Shared Web Hosting

Dear All,

I am on incubator, Need help deploying YII Project on Shared Linux Web Hosting

The system is running perfectly on localhost, as we had the Command line access. In shared hosting they do not provide shell access…

Now when deploying over the net we simply uploaded the website, paths have been defined… But all experiments of no use.

I am getting error as below

exception ‘CException’ with message ‘Property “CConsoleApplication.theme” is not defined.’ in /home/theinjsl/public_html/testinfo/framework/base/CComponent.php:173 Stack trace: #0 /home/theinjsl/public_html/testinfo/framework/base/CModule.php(513): CComponent->__set(‘theme’, ‘fancy’) #1 /home/theinjsl/public_html/testinfo/framework/base/CApplication.php(150): CModule->configure(Array) #2 /home/theinjsl/public_html/testinfo/framework/YiiBase.php(125): CApplication->__construct(’/home/theinjsl/…’) #3 /home/theinjsl/public_html/testinfo/framework/YiiBase.php(113): YiiBase::createApplication(‘CConsoleApplica…’, ‘/home/theinjsl/…’) #4 /home/theinjsl/public_html/testinfo/framework/yiic.php(23): YiiBase::createConsoleApplication(’/home/theinjsl/…’) #5 /home/theinjsl/public_html/index.php(33): require_once(’/home/theinjsl/…’) #6 {main}

Friends need help to take this project out of Intensive Care Unit…

Do you have ftp access?

Are you sure you have copied full framework code on it?

Hi guys now i am getting a long CDbException Error as below:

CDbException

CDbConnection.connectionString cannot be empty.

/home/theinjsl/public_html/testinfo/framework/db/CDbConnection.php(369)

357 return $this;

358 }

359

360 /**

361 * Opens DB connection if it is currently not

362 * @throws CException if connection fails

363 */

364 protected function open()

365 {

366 if($this->_pdo===null)

367 {

368 if(empty($this->connectionString))

369 throw new CDbException(‘CDbConnection.connectionString cannot be empty.’);

370 try

371 {

372 Yii::trace(‘Opening DB connection’,‘system.db.CDbConnection’);

373 $this->_pdo=$this->createPdoInstance();

374 $this->initConnection($this->_pdo);

375 $this->_active=true;

376 }

377 catch(PDOException $e)

378 {

379 if(YII_DEBUG)

380 {

381 throw new CDbException('CDbConnection failed to open the DB connection: '.

Stack Trace

#0

/home/theinjsl/public_html/testinfo/framework/db/CDbConnection.php(330): CDbConnection->open()

#1

/home/theinjsl/public_html/testinfo/framework/db/CDbConnection.php(308): CDbConnection->setActive(true)

#2

/home/theinjsl/public_html/testinfo/framework/base/CModule.php(387): CDbConnection->init()

#3

/home/theinjsl/public_html/testinfo/framework/base/CApplication.php(438): CModule->getComponent("db")

#4

/home/theinjsl/public_html/testinfo/framework/db/ar/CActiveRecord.php(623): CApplication->getDb()

#5

/home/theinjsl/public_html/testinfo/framework/db/ar/CActiveRecord.php(2309): CActiveRecord->getDbConnection()

#6

/home/theinjsl/public_html/testinfo/framework/db/ar/CActiveRecord.php(387): CActiveRecordMetaData->__construct(User)

#7

/home/theinjsl/public_html/testinfo/framework/db/ar/CActiveRecord.php(402): CActiveRecord::model("User")

#8

/home/theinjsl/public_html/testinfo/framework/db/ar/CActiveRecord.php(77): CActiveRecord->getMetaData()

#9

/home/theinjsl/public_html/themes/fancy/views/layouts/header.php(23): CActiveRecord->__construct()

18 <?php

19 echo CHtml::link(‘Register’, Yii::app()->urlManager->baseUrl . ‘/register’);

20 }

21

22

23 $userModel = new User();

24 $userRec = $userModel->getUserRecById();

25 ?>

26 </div>

27 <div class="logo left">

28 <?php echo CHtml::link(CHtml::image(AppHelper::getAsset(‘img/logo.gif’)), Yii::app()->urlManager->baseUrl); ?>

#10

/home/theinjsl/public_html/themes/fancy/views/layouts/main.php(55): include_once("/home/theinjsl/public_html/themes/fancy/views/layouts/header.php")

50 }

51

52 </script>

53

54 <div class="mainpage">

55 <?php include_once(‘header.php’); ?>

56 <!–div class="slider-holder"> </div–>

57 <?php

58 if (Yii::app()->request->pathInfo == ‘’)

59 {

60 ?>

#11

/home/theinjsl/public_html/testinfo/framework/web/CBaseController.php(126): require("/home/theinjsl/public_html/themes/fancy/views/layouts/main.php")

#12

/home/theinjsl/public_html/testinfo/framework/web/CBaseController.php(95): CBaseController->renderInternal("/home/theinjsl/public_html/themes/fancy/views//layouts/main.php", array("content" => " <!–div id="content"–> <!–SEPERATOR–> <div class="s…"), true)

#13

/home/theinjsl/public_html/testinfo/framework/web/widgets/CContentDecorator.php(76): CBaseController->renderFile("/home/theinjsl/public_html/themes/fancy/views//layouts/main.php", array("content" => " <!–div id="content"–> <!–SEPERATOR–> <div class="s…"), true)

#14

/home/theinjsl/public_html/testinfo/framework/web/widgets/CContentDecorator.php(54): CContentDecorator->decorate(" <!–div id="content"–> <!–SEPERATOR–> <div class="s…")

#15

/home/theinjsl/public_html/testinfo/framework/web/widgets/COutputProcessor.php(44): CContentDecorator->processOutput(" <!–div id="content"–> <!–SEPERATOR–> <div class="s…")

#16

/home/theinjsl/public_html/testinfo/framework/web/CBaseController.php(206): COutputProcessor->run()

#17

/home/theinjsl/public_html/testinfo/framework/web/CBaseController.php(300): CBaseController->endWidget("CContentDecorator")

#18

/home/theinjsl/public_html/themes/fancy/views/layouts/column1.php(15): CBaseController->endContent()

10 <?php endif ?>

11 <!–div id="content"–>

12 <?php echo $content; ?>

13 <!–/div>< content -->

14 </div>

15 <?php $this->endContent(); ?>

#19

/home/theinjsl/public_html/testinfo/framework/web/CBaseController.php(126): require("/home/theinjsl/public_html/themes/fancy/views/layouts/column1.ph…")

#20

/home/theinjsl/public_html/testinfo/framework/web/CBaseController.php(95): CBaseController->renderInternal("/home/theinjsl/public_html/themes/fancy/views//layouts/column1.p…", array("content" => "<!–SEPERATOR–> <div class="separator"> <div class="slide-p…", "leftcol" => "", "rightcol" => ""), true)

#21

/home/theinjsl/public_html/protected/components/Controller.php(219): CBaseController->renderFile("/home/theinjsl/public_html/themes/fancy/views//layouts/column1.p…", array("content" => "<!–SEPERATOR–> <div class="separator"> <div class="slide-p…", "leftcol" => "", "rightcol" => ""), true)

#22

/home/theinjsl/public_html/protected/controllers/SiteController.php(70): Controller->render("index")

#23

/home/theinjsl/public_html/testinfo/framework/web/actions/CInlineAction.php(49): SiteController->actionIndex()

#24

/home/theinjsl/public_html/testinfo/framework/web/CController.php(308): CInlineAction->runWithParams(array())

#25

/home/theinjsl/public_html/testinfo/framework/web/CController.php(286): CController->runAction(CInlineAction)

#26

/home/theinjsl/public_html/testinfo/framework/web/CController.php(265): CController->runActionWithFilters(CInlineAction, array())

#27

/home/theinjsl/public_html/testinfo/framework/web/CWebApplication.php(282): CController->run("")

#28

/home/theinjsl/public_html/testinfo/framework/web/CWebApplication.php(141): CWebApplication->runController("")

#29

/home/theinjsl/public_html/testinfo/framework/base/CApplication.php(169): CWebApplication->processRequest()

#30

/home/theinjsl/public_html/index.php(13): CApplication->run()


Hi Shiv,

Thanks for support…

Yes we have ftp access and copied both folders.

Hi i’m new here and i was looking in many topics if someone got

the same problem as me, and it seems yes! (i think)

I work on many websites before, and use msqli instructions (that works)

but for a website i use yii, who’s use PDO instructions;

So here is my problem:

My app works on local host, no problem with db, but when i try to

put it on distant server it’s crash.

i’ve this message:


CDbException


\www\CyxisOnline\yii\framework\db\CDbConnection.php(381)


369                 throw new CDbException('CDbConnection.connectionString cannot be empty.');

370             try

371             {

372                 Yii::trace('Opening DB connection','system.db.CDbConnection');

373                 $this->_pdo=$this->createPdoInstance();

374                 $this->initConnection($this->_pdo);

375                 $this->_active=true;

376             }

377             catch(PDOException $e)

378             {

379                 if(YII_DEBUG)

380                 {

381                     throw new CDbException('CDbConnection failed to open the DB connection: '.

382                         $e->getMessage(),(int)$e->getCode(),$e->errorInfo);

383                 }

384                 else

385                 {

386                     Yii::log($e->getMessage(),CLogger::LEVEL_ERROR,'exception.CDbException');

387                     throw new CDbException('CDbConnection failed to open the DB connection.',(int)$e->getCode(),$e->errorInfo);

388                 }

389             }

390         }

391     }

Stack:


#7 	

–

\www\CyxisOnline\protected\models\TblUser.php(21): CActiveRecord::model("TblUser")


16      * @param string $className active record class name.

17      * @return TblUser the static model class

18      */

19     public static function model($className=__CLASS__)

20     {

21         return parent::model($className);

22     }

23 

24     /**

25      * @return string the associated database table name

26      */


#8 	

–

\www\CyxisOnline\protected\components\UserIdentity.php(41): TblUser::model()


36     private $_id;

37     

38     public function authenticate()

39     {

40         

41         $record= TblUser::model()->findByAttributes(array('username'=>$this->username));

42         if($record===null)

43         {

44             $this->_id='user Null';

45             $this->errorCode=self::ERROR_USERNAME_INVALID;

46         }


#9 	

–

\www\CyxisOnline\protected\models\LoginForm.php(52): UserIdentity->authenticate()


47     public function authenticate($attribute,$params)

48     {

49         if(!$this->hasErrors())

50         {

51             $this->_identity=new UserIdentity($this->username,$this->password);

52             if(!$this->_identity->authenticate())

53                 $this->addError('password','Incorrect username or password.');

54         }

55     }

56 

57     /**

#13

\www\CyxisOnline\protected\controllers\SiteController.php(94): CModel->validate()


89         // collect user input data

90         if(isset($_POST['LoginForm']))

91         {

92             $model->attributes=$_POST['LoginForm'];

93             // validate user input and redirect to the previous page if valid

94             if($model->validate() && $model->login())

95                 $this->redirect(Yii::app()->user->returnUrl);

96         }

97         // display the login form

98         $this->render('login',array('model'=>$model));

99     }

#21 	

\www\CyxisOnline\index.php(13): CApplication->run()


08 defined('YII_DEBUG') or define('YII_DEBUG',true);

09 // specify how many levels of call stack should be shown in each log message

10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);

11 

12 require_once($yii);

13 Yii::createWebApplication($config)->run();



here is my code:


// uncomment the following to use a MySQL database

		

		'db'=>array(

			'connectionString' => 'mysql:host=xxxx.olikeopen.com;dbname=xxxxx_cyxismaindb',

			//'emulatePrepare' => true,

			'username' => 'xxxxxx',

			'password' => 'xxxxxx',

			//'charset' => 'utf8',

		),

thanks!

up!