Yii Framework Forum: Yiiboilerplate Setup Problem - Yii Framework Forum

Jump to content

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

Yiiboilerplate Setup Problem Rate Topic: -----

#1 User is offline   Sinix 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 07-October 12

Posted 09 October 2012 - 04:20 AM

Hello,

It seems that the YiiBoilerplate (http://www.yiiframew...ure-in-seconds/) is a really great solution for a Yii project structure and I'm struggling more than five days to setup the YiiBoilerplate on local machine. But from some reason the application can't connect to the database providing the error: 'CDbConnection failed to open the DB connection.'.

Here are the configuration details:

1) Environment on local machine

- the files are not located in htdocs root, but in subfolder yiiboil
- db names are yiiboil and yiiboil_test, respectively
- db user is root
- db password is blank
- MySQL works on port 3306
- I downloaded the latest zip file from the GitHub
- all files have proper permissions

2) I made the following changes in files /common/environments/params-prod.php:

return array(
	'env.code' => 'prod',
	// DB connection configurations
	'db.name' => '',
	'db.connectionString' => 'mysql:host=localhost;dbname=yiiboil',
	'db.username' => 'root',
	'db.password' => '',

	// test database {
	'testdb.name' => '',
	'testdb.connectionString' => 'mysql:host=localhost;dbname=yiiboil_test',
	'testdb.username' => 'root',
	'testdb.password' => '',
);


3) After the files were saved, I run the command ./runpostdeploy prod migrate in order to configure the application and import data. The following error occured:

'CDbConnection failed to open the DB connection.'

with the strack trace:

Yii Migration Tool v1.0 (based on Yii v1.1.11)

exception 'CDbException' with message 'CDbConnection failed to open the DB connection.' in /opt/lampp/htdocs/yiiboil/common/lib/Yii/db/CDbConnection.php:388
Stack trace:
#0 /opt/lampp/htdocs/yiiboil/common/lib/Yii/db/CDbConnection.php(331): CDbConnection->open()
#1 /opt/lampp/htdocs/yiiboil/common/lib/Yii/db/CDbConnection.php(309): CDbConnection->setActive(true)
#2 /opt/lampp/htdocs/yiiboil/common/lib/Yii/base/CModule.php(388): CDbConnection->init()
#3 /opt/lampp/htdocs/yiiboil/common/lib/Yii/cli/commands/MigrateCommand.php(442): CModule->getComponent('db')
#4 /opt/lampp/htdocs/yiiboil/common/lib/Yii/cli/commands/MigrateCommand.php(451): MigrateCommand->getDbConnection()
#5 /opt/lampp/htdocs/yiiboil/common/lib/Yii/cli/commands/MigrateCommand.php(482): MigrateCommand->getMigrationHistory(-1)
#6 /opt/lampp/htdocs/yiiboil/common/lib/Yii/cli/commands/MigrateCommand.php(85): MigrateCommand->getNewMigrations()
#7 [internal function]: MigrateCommand->actionUp(Array)
#8 /opt/lampp/htdocs/yiiboil/common/lib/Yii/console/CConsoleCommand.php(173): ReflectionMethod->invokeArgs(Object(MigrateCommand), Array)
#9 /opt/lampp/htdocs/yiiboil/common/lib/Yii/console/CConsoleCommandRunner.php(67): CConsoleCommand->run(Array)
#10 /opt/lampp/htdocs/yiiboil/common/lib/Yii/console/CConsoleApplication.php(92): CConsoleCommandRunner->run(Array)
#11 /opt/lampp/htdocs/yiiboil/common/lib/Yii/base/CApplication.php(162): CConsoleApplication->processRequest()
#12 /opt/lampp/htdocs/yiiboil/common/lib/Yii/yiic.php(34): CApplication->run()
#13 /opt/lampp/htdocs/yiiboil/console/yiic.php(15): require_once('/opt/lampp/htdo...')
#14 /opt/lampp/htdocs/yiiboil/yiic(3): require_once('/opt/lampp/htdo...')
#15 {main}
========================================================
Done!


4) The problem exists even if I uncomment db params array in /backend/config/main.php and console/config/main.php, e.g.:

...
'db'=> array(
	'connectionString' => $params['db.connectionString'],
	'username' => $params['db.username'],
	'password' => $params['db.password'],
	'schemaCachingDuration' => YII_DEBUG ? 0 : 86400000, // 1000 days
	'enableParamLogging' => YII_DEBUG,
	'charset' => 'utf8'
),
...


5) I run manually the migration script for creating and importing data in the user table, but the problem still exists.

Consider that all other "pure" Yii projects work without any problems on the local machine even if they are in subfolders.

I have a couple of questions:

- does anybody know what additional step(s) I should perform or where I made mistakes?
- can the YiiBoilerplate be configured in a subfolder rather than in a website's root?
- should db param in main.php files be uncommented or not?
0

#2 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 09 October 2012 - 04:34 AM

/* Moved from Yii Powered to Extensions ... */
"Less noise - more signal"
0

#3 User is offline   Ivica 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 316
  • Joined: 25-May 11

Posted 28 October 2012 - 03:21 AM

You should setup your database connection info in console/config/main.php file too, because that file is used for deployment and migrations.
Zurmo: Yii Powered Open Source CRM
zurmo.org
0

#4 User is offline   Tushar 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 30-July 13

Posted 29 August 2013 - 10:40 AM

i have same problem as you buddy sinix, I dont understand how to setup and run yii boilerplate project ??? if you get some info then please share with me.
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