move framework folder out of public_html directory


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.



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



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?



That depends on your web host.

Put this in your index.php:




    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.


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?


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

Thank you again.