Db Connection On Godaddy Won't Work

new to webbing and Yii, so i hope that there is a simple fix due to my ignorance.

in brief:

I have a yii web app that:

  • when running local with Apache server will connect to a mysql db on godaddy

  • when yii app is on godaddy server it will not connect to the same db on godaddy

-godaddy web server is windows IIS 7.0 running php 5.3

  • godaddy put a script in my root folder which is able to make a connection with my database so it appears that the problem is hosting my website on their server.

the error is:

CDbConnection failed to open the DB connection: could not find driver

D:\Hosting\11584291\html\yii\framework\db\CDbConnection.php(364)

352 throw new CDbException(Yii::t(‘yii’,‘CDbConnection.connectionString cannot be empty.’));

353 try

354 {

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

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

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

358 $this->_active=true;

359 }

360 catch(PDOException $e)

361 {

362 if(YII_DEBUG)

363 {

364 throw new CDbException(Yii::t(‘yii’,‘CDbConnection failed to open the DB connection: {error}’,

365 array(’{error}’=>$e->getMessage())),(int)$e->getCode(),$e->errorInfo);

366 }

367 else

368 {

369 Yii::log($e->getMessage(),CLogger::LEVEL_ERROR,‘exception.CDbException’);

370 throw new CDbException(Yii::t(‘yii’,‘CDbConnection failed to open the DB connection.’),(int)$e->getCode(),$e->errorInfo);

371 }

372 }

373 }

374 }

375

376 /**

any ideas why the web app cannot make the db connection when hosted with godaddy?

Hi,

Did you change the setting inside main.php file when you change to godaddy server

	'db'=>array(


		'connectionString' => 'mysql:host=localhost;dbname=databasename',


		'emulatePrepare' => true,


		'username' => 'root',


		'password' => 'admin',


		'charset' => 'utf8',


	),

Thanks

chandran nepolean

From what I can tell, GoDaddy does not enable the MySQL PDO driver on Windows machines (see here). Move to a Linux installation.

Thanks!- it was the PDO driver.