I use localhost for development, i have put yii in web in-accessible folder, and development is fine.Now if i want to upload this localhost project to a shared host.Do i upload yii folder and my project(webroot/application) to shared host or do i create the whole set up as created for localhost and then add project specific controller views & models…Please help
I will only add to zaccaria’s answer that putting Yii into web-accessible directory is not a good idea and therefore, you should avoid it, if it is only possible. There is a number of hosting services that do not allow user to do anything outside web-accessible directory and in this situation there is no other option left like to have both app and yii in the same folder.
On the other hand, if you have access to some folder outsite web-accessible directory on your hosting and if you are a bit experienced in Linux, consider reading and introducing solutions given in this Wiki article, for boosting security of your app up.
i found the answer. you need to setup the framework path in index.php of your webroot/webapp that it then the framework is accessible to your application.
I’ve uploaded Yii to my hosting, and I’s use modules in Yii.
After uploaded project, I can access to myhost.vn/beta/example (example is my project).
When I try to access into modules like: myhost.vn/beta/admin/exampleAdminTest, it bring me "Not Found, The requested URL xxxx was not found on this server."
Any idea? I’ve set mode 777 to assets and runtime for both directories
If I’m not mistaken, not found (404?) means an error directly from Apache or other server that is serving your hosting, not from Yii. That is why I would follow zaccaria’s advice on checking case sensitivity of your files / folders / path / url.
Try to put a simple HTML file in the folder, where you have your module and try to assess it directly by entering it’s path and filename do browser address bar. This should ensure you, if problem lies in Yii or in your server configuration or path structure.
I have a different problem, after uploaded the application & the framework, they work fine in the first access (homepage/index.php), but when user logged-in, it shows Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /home/myappname/public_html/protected/controllers/SiteController.php on line 57.
What is the meaning of that error? and how to solve it? is Yii not "compatible" with my web hosting (not a free hosting)? The application works just fine in localhost.
public function actionTable()
{
if($_POST)
{
$tname=explode('_',$_POST['tableName']);
foreach($tname as $item){
$table.=(string)ucwords($item);
}
$model=$table::model()->findAll();
}
// Shows tables of database
$this->render('table',array(
'model'=>$model,
));
}
in my SiteController without creating Site model. I want to show (in CGridView) table content choosen by user (dropDownList). Why the error only occur in my hosting, not in localhost? What is the best suggestion for doing this?
According to this topic, i’ve try to change my controller like below
public function actionTable()
{
if($_POST)
{
$table='';
$tname=explode('_',$_POST['tableName']);
foreach($tname as $item){
$table.=(string)ucwords($item);
}
//$model=$table::model()->findAll();
$model=CActiveRecord::model($table)->findAll();
}
// Shows tables of database
$this->render('table',array(
'model'=>$model,
));
}
and it is working fine now. The main problem is PHP version in the hosting server doesn’t support double colon. And i’ve put variable $table=’’; in the first line like mdomba suggestion.