Go Online - Real World Server - Index.php

Hello everybody,

I managed to complete my first project with Yii.

I tried to get online.

When i write mydomain_name.com i see the message:

"The server encountered an internal error." etc

My localhost/mydomain_name works without problems.

Do i have to change something in the index.php?

Such as


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

or

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

Hi @leo80

Did you upload both your project and the Yii framework on your server?

Yii framework is on the right path?

Also your server may has settings that not show the warnings and errors

Trace step by step your code by echoes among each line and die() php function

Thank you for the reply,

I have uploaded the Yii framework with my project.

Yii is on the right path.

Ok, check the variables of index.php . Also set reporting error to All





error_reporting(-1);

ini_set('error_reporting', E_ALL);


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

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


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

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


echo $yii.'<br/>';

echo $config;


require_once($yii);

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

I found the error.

I had an extra space between quotes at "connectionString" configuration.

I changed the code to:


'db'=>array(

	'connectionString' => 'mysql:host=host_server.com;dbname=db_my_name;',	

	'emulatePrepare' => true,

	'username' => 'my_name',

	'password' => 'my_pas',				

	'charset' => 'utf8',

), 

As Anyone has to take into consideration the various settings (and php-mysql version). Also Anyone has to check the little changes between localhost and online server :)

There were a lot of time that I forgot to do this correctly, but I take the connection error and corrected it

Your server was configured to not displays error messages, So it was difficult to identify the error