Deploying Yii On Internet

Hi everyone,

I have an app ready for deployment. My ISP has only one folder where I can put the yii framework and this is has the unchangable name of private. This folder cannot be accessed by web users. I get:

Error 500

CDbConnection failed to open the DB connection.

My folder structure is like this:

anonftp

bin

cgi-bin

.

.

httpdocs

________rouleur

_______________assets

_______________css

_______________images

_______________protected

_______________themes

_______________index.php

private

_______framework

.

.

In my index.php I have changed the path to framework




<?php


// change the following paths if necessary

$yii=dirname(__FILE__).'/../private/framework/yii.php';

$config=dirname(__FILE__).'/protected/config/main.php';


require_once($yii);

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

In my config/main.php:




<?php


// uncomment the following to define a path alias

// Yii::setPathOfAlias('local','path/to/local-folder');


// This is the main Web application configuration. Any writable

// CWebApplication properties can be configured here.

return array(

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

	'name'=>'Rouleur',


	// preloading 'log' component

	'preload'=>array('log','bootstrap'),


	// autoloading model and component classes

	'import'=>array(

		'application.models.*',

		'application.components.*',

	),


	'modules'=>array(

		// uncomment the following to enable the Gii tool

		/*

		'gii'=>array(

			'class'=>'system.gii.GiiModule',

			'password'=>'test',

			// If removed, Gii defaults to localhost only. Edit carefully to taste.

			'ipFilters'=>array('127.0.0.1','::1'),

                        'generatorPaths'=>array(

                            'bootstrap.gii'

                        ),

		),

		*/

	),


	// application components

	'components'=>array(

		'user'=>array(

			// enable cookie-based authentication

			'allowAutoLogin'=>true,

                        'class' => 'WebUser',

		),

                'bootstrap'=>array(

                    'class'=>'ext.bootstrap.components.Bootstrap',

                    'responsiveCss'=>true,

                ),

            


		// uncomment the following to enable URLs in path-format

		/*

		'urlManager'=>array(

			'urlFormat'=>'path',

			'rules'=>array(

				'<controller:\w+>/<id:\d+>'=>'<controller>/view',

				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

			),

		),

		*/

            

            /*

		'db'=>array(

			'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',

		),

             * 

             * 

             */

		// uncomment the following to use a MySQL database

		

		'db'=>array(

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

			'emulatePrepare' => true,

			'username' => 'username',

			'password' => 'password',

			'charset' => 'utf8',

                        'tablePrefix'=>'_tbl',

		),

		

		'errorHandler'=>array(

			// use 'site/error' action to display errors

			'errorAction'=>'site/error',

		),

		'log'=>array(

			'class'=>'CLogRouter',

			'routes'=>array(

				array(

					'class'=>'CFileLogRoute',

					'levels'=>'error, warning',

				),

				// uncomment the following to show log messages on web pages

				/*

				array(

					'class'=>'CWebLogRoute',

				),

				*/

			),

		),

	),


	// application-level parameters that can be accessed

	// using Yii::app()->params['paramName']

	'params'=>array(

		// this is used in contact page

		'adminEmail'=>'example@email.com',

	),

);

I have made a database on my ISP’s server with a username and password that I have included in the main config file

What could be the problem?

The problem could be that the db server is not localhost, or it could be that it requires you to specify a port number.

Thanks very much, this is a question I should have asked of my ISP. This is my first time to put any web development on a live server. I’m such a noob. Thanks again and I am hooked on yii framework