move framework folder out of public_html directory

Hi,

I am using Lunarpages web hosting.

I try to test yii configuration with the demo app Blog:

  1. I installed yii under public_html folder as the following. The blog app comes out file.

/public_html/yii/framework

/public_html/yii/demos/blog

  1. Then I move the framework folder out of the public_html folder as follows:

/public_html/yii/demos/blog

/yii/framework

and modified the statement in index.php

from: $yii=dirname(FILE).’/../../framework/yii.php’;

to: $yii=dirname(FILE).’/../../../../yii/framework/yii.php’;

and add echo statements in both yii.php and main.php.

Both echo statement are displayed, no error displayed, but the blog app doens’t come up.

I did the same test in my localhost with wamp server, the blog app comes up fine.

Does the framework folder have to be under public_html folder in a web hosting environment or there is something I missed?

Thanks,

jdev009

That depends on your web host.

Put this in your index.php:





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

if(!file_exists($yii))

{

    die("<font color=\"red\">Error:</font> Cannot find Yii!<br/>

            Please check and correct the path to Yii in <em>{$_SERVER['SERVER_NAME']}/index.php</em>");

}



Adjust the path until it stops failing.

jacmoe,

thank you for your help. The path for $yii was current and verified with the code you suggested.

I checked the web server error log, it says:

PHP Fatal error: Class ‘CController’ not found in /home/mydomain/public_html/yii/demos/blog/protected/components/Controller.php on line 6.

So it seems the framework is not loaded. Is there any other property to be set to load framework classes?

jacmoe,

Never mind, somehow, CController.php was corrupted. After I reuploaded the class file, the blog app works!

Thank you again.