500内部服务器错误 - 无错误日志

时间:2012-06-12 20:29:25

标签: php codeigniter error-handling internal-server-error

我有一个功能很好的功能。然后我将它上传到实时服务器,它给了我500内部服务器错误。谷歌搜索后,人们说,当某些事情(但他们不确定是什么)与服务器混淆时,你会得到一个错误。不是很有帮助。其他人说检查你的错误日志。我不知道该怎么做。

导致错误的函数===============================

 private function get_workstation () {
  //================ I tried deleting all but this and that got rid of the error== //
    if ($this->input->post('search')) {
        $search = $this->input->post('search');
        $where = 'ad_name ="'.$search.'" AND';
        $this->data['search'] = $search;
    } else {
        $where = '';
    }
    // ================================================================= //
    // Pagination Code //
    $numOfRows = $this->db->query('
        SELECT distinct sys_name 
        FROM v_rollout_sysuser 
        WHERE scope_ID = '. $this->session->userdata('scopeId') .'
    ');

    if ($this->input->get('page')) {
        $pageNum = $this->input->get('page');
    } else {
        $pageNum = 1;
    }

    $limit = ($pageNum - 1 ) * 50;
    $numRows = $numOfRows->num_rows();
    $totalPages = ceil($numRows / 50);

    $this->data['pageNum'] = $pageNum;
    $this->data['prevPage'] = $pageNum - 1;
    $this->data['nextPage'] = $pageNum + 1;
    $this->data['totalPages'] = $totalPages;

    // End of Pagination Code //

    $query = $this->db->query('
        SELECT * 
        FROM v_rollout_sysuser
        WHERE '.$where.' scope_ID = '. $this->session->userdata('scopeId') .'
        GROUP BY sys_name 
        LIMIT '.$limit.',50');

    $i = 0;

    foreach ($query->result() as $row) {
        $i = $i + 1;
        $data['i'] = $i;
        $data['ro_ID'] = $row->ro_ID;
        $data['sys_name'] = $row->sys_name;
        $data['EAM_Model'] = $row->EAM_Model;           
        $data['EAM_User'] = $row->ad_account;
        $data['ad_DispName'] = $row->ad_DispName;
        $data['search'] = $this->input->post('search');

        $systems[] = $data;
    }

    if(isset($systems)) {
        $this->data['systems'] = $systems;
    } else {
        $this->data['systems'] = null;
    }

}

5 个答案:

答案 0 :(得分:1)

您是否可以加载CodeIgniter网站的任何页面或仅加载某个页面?

以下步骤可能有助于您进行调试:

在主.htaccess文件中添加以下行:

php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on

在你的主index.php部分“应用程序环境”中,设置'开发'环境:

define('ENVIRONMENT', 'development');

您还可以在config / config.php文件的“错误记录阈值”部分中启用CodeIgniter错误记录

如果其中任何一项没有取得任何进展,请联系您的服务器管理员:)

答案 1 :(得分:1)

事实证明数据库存在问题。对那些花时间寻求帮助的人表示抱歉。运行数据库的人发现了问题。感谢你的尝试。

答案 2 :(得分:0)

它可能是->中的双$this->input->post,尝试将其拆分为单独的部分,例如

$a = $this->input;
if ($a->post('search')) {

根据我的经验,有些配置不喜欢$this->input->post之类的双打,特别是旧版本和一些IIS配置

答案 3 :(得分:0)

如果你是我,我会做以下调试:

  1. 将php错误报告设置为8191,将php_ini
  2. 中的display_errors设置为1
  3. 在每个相关条件中使用isset。
  4. 手动检查数据库连接。
  5. 希望这有帮助。

答案 4 :(得分:0)

请改为尝试:

$search = $this->input->post('search');
if ($search) {
    $where = 'ad_name ="'.$search.'" AND';
    $this->data['search'] = $search;
} else {
    $where = '';
}
相关问题