Yii Application Migrating From Windows To Linux Platform

MVC models fails without any error messages when I moved to linux server from window. Below is the model and the view.

Model


class ListModel extends CActiveRecord {

     const STATUS_PENDING = 0;


public static function model($className=__CLASS__) {

    return parent::model($className);

}


public function tableName() {

    return 'list_model';

}


public function rules() {

    return array(


        array('list_id,list_title,list_user,list_status', 'required'),

        array('list_title', 'length', 'max' => 255),


        array('list_id,list_status', 'numerical', 'integerOnly' => true),

    );

}

public function attributeLabels() {

    return array(

        'list_id' => 'Id',

        'list_title' => 'Title',

        'list_user' => 'User',

                    'list_status' => 'Status',


    );

}


public function search(){

    $criteria = new CDbCriteria();

    $criteria->compare('list_id',$this->list_id, true);

    $criteria->compare('list_title',$this->list_title, true);

    $criteria->compare('list_user',$this->list_user


    return new CActiveDataProvider($this, array(

        'criteria'=>$criteria,

        'sort'=>array('defaultOrder'=>'daillisting_complain_id DESC'),

    ));

}

public static function getCountPending(){

    $sql = "SELECT COUNT('list_id') FROM list_model WHERE list_status=".self::STATUS_PENDING;

    return  (int) Yii::app()->db

      ->createCommand($sql)

      ->queryScalar();


}

View




$pending =   ListModel::getCountPending();

//Fails to get fetch the count

$dataprovider =   $model->search();

also fails



No error logs messages is displayed.

I have checked the error log.




In the view executing the fetchs the result

		$sql = "SELECT COUNT(daillisting_complain_id) FROM daillisting_complain WHERE daillisting_complain_active=".self::STATUS_PENDING;

		$pending =   (int) Yii::app()->db

          ->createCommand($sql)

          ->queryScalar();



Initially I was getting the table does not exists due the case sensitive table names in linux. I renamed tables names.

Now the application fails in the models.

What is the solution?

File names are also case sensitive on Linux and you should check assets and runtime directory permissions. The http server must be able to write in them.

Query works if executed from the view but fails in the model.

There are no errors showing in the windows OS. I even tried renaming the table names, it did not help.

And directory permissions is set 0755

We were working with no problem on a local windows server but when we uploaded the project to a linux hosting it started giving us problems. At first we thought there was a problem with the tables but it was because of the case sensitivity.

We changed this ‘caseSensitive’=>false, to true and now everything works. We also had to change a few lines of code to upper case or lower case.

EDIT: we had this issue with Yii 1.1.X. I didn’t realize that I was in the Yii 2 forum, but it may help you.

Where to set the caseSensitive false.

In Yii 1.1.x it can be changed from /protected/config/main.php

I don’t think it will be very different in Yii 2.

It is resolved . I reinstalled application and uploaded each modules one by one and resolved the errors due to case sensitive(Controller Names,Model Names and Table Names).

Thanks