Yii Framework Forum: CDbConnection failed to open the DB - Yii Framework Forum

Jump to content

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

CDbConnection failed to open the DB Rate Topic: -----

#1 User is offline   Juan Pablo Sala 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 65
  • Joined: 16-June 09

Posted 22 July 2010 - 01:09 PM

Hello, maybe someone can help me with this problem I'm having;
When trying to use Yiic command line shell to create the model (model *) it outputs the following error:
exception 'CDbException' with message 'CDbConnection failed to open the DB'

I can not figure out what's happening, not only mysql pdo is there, I can do the following in my index.php:
$db = Yii::app()->db;
$command=$db->createCommand('select * from Alu');
$rows = $command->queryAll();
print_r($rows[0]);

and it works just fine
Don't know what to try :unsure:

Something?
thanks

Juan
0

#2 User is offline   Juan Pablo Sala 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 65
  • Joined: 16-June 09

Posted 22 July 2010 - 01:12 PM

just in case, the output from requirements.php

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 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 Warning CSecurityManager This is required by encrypt and decrypt methods.
SOAP extension Warning CWebService, CWebServiceAction
GD extension Passed CCaptchaAction

sorry for the output, it's a little kaos, but all is there :-*
0

#3 User is offline   PoL 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 506
  • Joined: 05-November 08
  • Location:Buenos Aires, Argentina

Posted 22 July 2010 - 01:15 PM

sometimes (eg. in wamp instalations) the CLI PHP uses another php.ini file diferent to the php.ini used for the web.
Hope you understand!
A way to know if they are different is running phpinfo() both from a web browser and from command line
Don't say what you think, think what you say
The problem is communication! Excess of communication!
1

#4 User is offline   Juan Pablo Sala 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 65
  • Joined: 16-June 09

Posted 22 July 2010 - 01:35 PM

good idea, I'll try that right now and let you know, thanks
0

#5 User is offline   Juan Pablo Sala 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 65
  • Joined: 16-June 09

Posted 22 July 2010 - 01:44 PM

excellent!! thanks a lot PoL, I'll try to think a little more next time!

Juan
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