Yii Framework Forum: move framework folder out of public_html directory - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

move framework folder out of public_html directory Rate Topic: -----

#1 User is offline   jdev009 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 09-February 12

Posted 09 February 2012 - 06:10 PM

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

2. 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
0

#2 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,894
  • Joined: 10-October 10
  • Location:Denmark

Posted 09 February 2012 - 06:24 PM

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.
"Less noise - more signal"
0

#3 User is offline   jdev009 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 09-February 12

Posted 09 February 2012 - 10:40 PM

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?
0

#4 User is offline   jdev009 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 09-February 12

Posted 09 February 2012 - 11:19 PM

jacmoe,

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

Thank you again.
1

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users