dongling4383 2014-09-04 22:10 采纳率: 100%
浏览 58
已采纳

在Windows和Linux中使用codeigniter时命名约定问题

I have made a web application in codeigniter framework. I was developing the app on a Windows machine and the final version runs perfectly well on the same (i.e windows, wamp to be precise). Now i need to deploy the app on a ubuntu server. After the initial login required in the app, it does not display any other page.On inspecting the console, I found this

[09:08:37.255] GET http://localhost/sac.org/index.php/member [HTTP/1.0 500 Internal Server Error 17ms]

I think this is a very common problem, as is evident from these questions:

codeigniter framework not working on linux

Windows code not working on linux

codeigniter upload not working on linux

and here too Codeigniter issue

and many more. The answers mentioned in these threads are not working for me. Is there some way to solve this issue?

My code sample is

<?php
class member extends CI_Controller{
    public $data1 = "";
    public function __construct(){
        parent::__construct();
        $this->load->helper('form');
        $this->load->helper('url');
        $this->load->library('session');
        $this->load->library('table');      
        $this->load->model('membermodel');
        $this->data1 = $this->membermodel->getYearList();
    }
    private function accesscheck(){
        $privilege = $this->session->userdata('privilege');
        if($privilege=='2'||$privilege=='1'){
            return "True";
        }

    }

    public function index(){
        echo phpinfo();
        die();
        if($this->accesscheck()){
        $data = array('years'=>$this->membermodel->getYearList());
        $notifications = $this->membermodel->numberOfNotifications();
        $this->session->set_userdata('notifications',$notifications);
        $this->load->view('templates/header',$data);
        $this->load->view('templates/menu');
        $this->load->view('members/home',$data);
        $this->load->view('templates/footer');

    }
else{
    $this->load->view('templates/accessErr');
}}

    public function year($year){
        if($this->accesscheck()){

            $this->getTable($year,"FullList");


    }else{
    $this->load->view('templates/accessErr');
}}

    public function positive($year){
        if($this->accesscheck()){
            $this->gettable($year,"positive");
        }else{
            $this->load->view('templates/accessErr');
        }
    }
    public function negative($year){
                if($this->accesscheck()){

                    $this->getTable($year,"negative");

}
    else{
    $this->load->view('templates/accessErr');
}}
    public function neutral($year){
                if($this->accesscheck()){
            $this->getTable($year,"neutral");


    }else{
    $this->load->view('templates/accessErr');
}}

    public function registered($year){
                if($this->accesscheck()){

                    $this->gettable($year,"register");

    }else{
    $this->load->view('templates/accessErr');
}}
    public function uncontacted($year){
                        if($this->accesscheck()){
            $this->getTable($year,"uncontacted");

    }else{
    $this->load->view('templates/accessErr');
}}
    public function unsearched($year){
                        if($this->accesscheck()){
            $this->getTable($year,"unsearched");


    }else{
    $this->load->view('templates/accessErr');
}}
    public function notfound($year){
                                if($this->accesscheck()){

                $this->gettable($year,"notFound");


    }else{
    $this->load->view('templates/accessErr');
}}
public function Paid($year){
    if($this->accessCheck()){

                    $this->getTable($year,"Paid");


    }else{
    $this->load->view('templates/accessErr');
}}
public function getProfile(){
    $id=$this->input->get('id');
    $data = $this->membermodel->getPrimaryInfo($id);

    echo json_encode($data);
}
public function getTable($year,$list){
    $this->data1 = $this->membermodel->getYearList();
        if(in_array(array('alumSince'=>$year),$this->data1)){// think of a get around
            $data['table'] = $this->membermodel->getTable($year,$list);
            $data['year'] = $year;
            $this->load->view('templates/header');
            $this->load->view('templates/menu');
            $this->load->view('members/fullList',$data);
            $this->load->view('templates/footer');
        }else{
            $this->load->view('templates/header');
            $this->load->view('templates/badParam');
            $this->load->view('templates/footer');
        }
}


public function search(){

        if($this->session->userdata('privilege')){
        $this->load->view('templates/header');
        $this->load->view('templates/menu');
        $this->load->view('members/search');
        $this->load->view('templates/footer');

        }
        else
        $this->load->view('templates/accessErr');
    }

    public function generate_result(){


        if($this->session->userdata('privilege')){
            $data = $this->membermodel->search();

                        if($data){
                            $this->load->view('templates/header');
                            $this->load->view('templates/menu');
                            $this->load->view('members/search_result',$data);
                            $this->load->view('templates/footer');
                        }



        }else{
            $this->load->view('templates/accessErr');
}

}

public function updateProfile(){
    if($this->accessCheck()){
        if($this->input->post('submit')){

            if($msg = $this->membermodel->updateProfile()){
                header('Refresh:2,url='.$_SERVER["HTTP_REFERER"]);//security issues here
                echo $msg;
            }
        }

    }else{
        $this->load->view('templates/accessErr');
    }


}

public function updateSearch(){
    if($this->accessCheck()){
        $alumid = $this->input->get('alumid');
        $search = $this->input->get('search');
        $result = $this->membermodel->updateSearch($alumid,$search);
            echo $result;
        }
        else{
        $this->load->view('templates/accessErr');
    }
}
public function updateResponse(){
    if($this->accessCheck()){
        $alumid = $this->input->get('alumid');
        $response = $this->input->get('response');
        $result = $this->membermodel->updateResponse($alumid,$response);
            echo $result;
        }
        else{
        $this->load->view('templates/accessErr');
    }
}
public function updatePayment(){
    if($this->accessCheck()){
            $alumid = $this->input->get('alumid');
            $dateofpayment = $this->input->get('dateofpayment');
            $referenceNo =  $this->input->get('referenceNo');
            $paymentAmt = $this->input->get('paymentAmt');
            $remarks = $this->input->get('remarks');
            $result = $this->membermodel->updatePayment($alumid,$dateofpayment,$referenceNo,$paymentAmt,$remarks);

                echo $result;




    }else{
        $this->load->view('templates/accessErr');
    }
}
public function updateRegister(){
    if($this->accessCheck()){
            $register  = $this->input->get('register');
            $alumid = $this->input->get('alumid');
            $result = $this->membermodel->updateRegister($alumid,$register);

                echo $result;




    }else{
        $this->load->view('templates/accessErr');
    }
}
public function addCallDetail(){
    $alumid = $this->input->get('alumid');
    date_default_timezone_set('Asia/Calcutta');
    $date = date('Y-m-d');
    $time = date('H:i:s');
    echo $this->membermodel->addCallDetail($alumid,$date,$time);
}

public function updateCall(){
        $remarks = $this->input->get('remarks');
        $nextdate = $this->input->get('nextdate');
        $nexttime = $this->input->get('nexttime');
        $callid = $this->input->get('callid');
        $alumid = $this->input->get('alumid');
        echo $this->membermodel->updateCall($remarks,$nextdate,$nexttime,$callid,$alumid);

}
public function updateMember(){
        $name = $this->input->get('name');
        $age = $this->input->get('age');
        $gender = $this->input->get('gender');
        $relationship = $this->input->get('relationship');
        $alumid = $this->input->get('alumid');
        echo $this->membermodel->updateMember($name,$age,$gender,$relationship,$alumid);

}
public function removeAccompaniant(){
        $memberid = $this->input->get('id');
        $alumid = $this->input->get('alumid');
        echo $this->membermodel->removeAccompaniant($memberid,$alumid);

}
public function updateRemark(){
    $remark = $this->input->get('remark');
    $alumid = $this->input->get('alumid');

    echo $this->membermodel->updateRemark($alumid,$remark);
}


public function getNetworkingSummary($year){

    $userid = $this->membermodel->getUserId();
    if($data =  $this->membermodel->getNetworkingSummary($userid,$year))
        echo json_encode($data);

        //echo json_encode($data['msg']="boo");
}
public function getNotifications(){
    if($this->accessCheck()){
        $data['result'] = $this->membermodel->getNotifications();
        $this->load->view('templates/header');
        $this->load->view('templates/menu');
        $this->load->view('templates/dummyMember',$data);
        $this->load->view('templates/footer');
    }else{
        $this->load->view('templates/accessErr');

    }

}
public function notificationStatus(){
    $id = $this->input->get('id');

    $this->membermodel->updateNotificationStatus($id);

}

}
?>
  • 写回答

1条回答 默认 最新

  • dongqin6926 2014-09-04 22:35
    关注

    As advised by Prix, I checked my error log and found that the problem was due to syntax error. I was using Function array dereferencing which has been added in PHP 5.4.0 but my server was running PHP 5.2.

    The solution is here

    The solution worked. I had to resort to this method rather than upgrading my PHP version because the server is running UBUNTU 12.04 which has no repos for PHP 5.4 .

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)