Привет, у меня есть PHP-код, который использовал codeigniter. Он работает на локальном хосте отлично. После того, как я загружу его на сервер fatcow, он терпит неудачу. Но не только один контроллер. Есть четыре контроллера (страницы, сообщения, тренинги, пользователи), каждый контроллер работает нормально, кроме сообщений. Когда я пытаюсь загрузить функции контроллера сообщений, он показывает сообщение об ошибке 500.codeigniter controller показывает 500 на сервере fatcow
Я пытался переименовать Сообщений контроллер отчетов и его модель, чтобы сообщить переименовал взгляды, но это не решает мою проблему
current file names:
model: report.php
controller: reports.php
view: report/index.php, report/view.php
********** EDIT ЗДЕСЬ IS reports.php **********
class Reports extends MY_Controller {
public function __construct() {
parent::__construct();
}
public function index() {
//Pagination Configuration
$this->custom_config["total_rows"] = $this->report->record_count($tag);
$this->custom_config["per_page"] = 5;
$choice = $this->custom_config["total_rows"]/$this->custom_config["per_page"];
$this->custom_config["num_links"] = round($choice);
$this->pagination->initialize($this->custom_config);
$page = ($this->uri->segment($this->custom_config["uri_segment"])) ? $this->uri->segment($this->custom_config["uri_segment"]) : 0;
$data['tags'] = explode(',', $this->report->tags()['tags']);
$data['tags'] = array_unique($data['tags']);
$data['reports'] = $this->report->get($this->custom_config["per_page"], $page);
$this->load->view('template/head');
$this->load->view('template/header');
$this->load->view('reports/index', $data);
$this->load->view('template/footer', $this->footer);
}
public function tag($tag = FALSE) {
$tag = ($tag !== FALSE) ? urldecode($tag) : $tag;
//Pagination Configuration
$this->custom_config["total_rows"] = $this->report->record_count($tag);
$this->custom_config["per_page"] = 5;
$choice = $this->custom_config["total_rows"]/$this->custom_config["per_page"];
$this->custom_config["num_links"] = round($choice);
$this->pagination->initialize($this->custom_config);
$page = ($this->uri->segment($this->custom_config["uri_segment"])) ? $this->uri->segment($this->custom_config["uri_segment"]) : 0;
$data['tags'] = explode(',', $this->report->tags()['tags']);
$data['tags'] = array_unique($data['tags']);
$data['reports'] = $this->report->get($this->custom_config["per_page"], $page, FALSE, $tag);
$this->load->view('template/head');
$this->load->view('template/header');
$this->load->view('reports/index', $data);
$this->load->view('template/footer', $this->footer);
}
public function view($slug) {
$data['tags'] = explode(',', $this->report->tags()['tags']);
$data['tags'] = array_unique($data['tags']);
$data['report'] = $this->report->get(1, 0, $slug);
if(empty($data['report'])) {
show_404();
} else {
$this->load->view('template/head');
$this->load->view('template/header');
$this->load->view('reports/view', $data);
$this->load->view('template/footer', $this->footer);
}
}
}
****** EDIT ВОТ report.php (модель) *******
class Report extends CI_Model {
function __construct() {
parent::__construct();
}
function record_count($tag = FALSE) {
$this->db->from('categories');
$this->db->join('contents','categories.id = contents.category_id');
$this->db->where('categories.name', 'post');
if ($tag !== FALSE) {
$this->db->like('status', $tag);
}
return $this->db->count_all_results();
}
function get($limit, $start, $slug = FALSE, $tag = FALSE) {
if($this->session->userdata('language') == 'english') {
$this->db->select('slug, status, name_en as name, content_en as content, started_on, ended_on, admins.name as author');
} else {
$this->db->select('slug, status, contents.name, content, started_on, ended_on, admins.name as author');
}
$this->db->limit($limit, $start);
$this->db->from('categories');
$this->db->join('contents','categories.id = contents.category_id');
$this->db->join('admins','admins.id = contents.admin_id');
$this->db->where('categories.name', 'post');
$this->db->order_by("contents.id", "desc");
if ($tag !== FALSE) {
$this->db->like('status', $tag);
}
if ($slug !== FALSE) {
$this->db->where('slug', $slug);
$query = $this->db->get();
return $query->row_array();
}
$query = $this->db->get();
return $query->result_array();
}
function get_footer() {
if($this->session->userdata('language') == 'english') {
$this->db->select('slug, name_en as name');
}
$this->db->from('categories');
$this->db->join('contents','categories.id = contents.category_id');
$this->db->where('categories.name', 'post');
$this->db->order_by("contents.id", "desc");
$this->db->limit(2);
$query = $this->db->get();
return $query->result_array();
}
function tags() {
$this->db->select('group_concat(status) as tags');
$this->db->from('categories');
$this->db->join('contents','categories.id = contents.category_id');
$this->db->where('categories.name', 'post');
$query = $this->db->get();
return $query->row_array();
}
}
Без каких-либо журналов кода или сервера, на которые можно смотреть, практически невозможно узнать, почему вы будете получать эту ошибку. –
Я добавил report.php (сообщает контроллер) код. Я не могу найти журнал ошибок в fatcow. В журнале доступа нет полезной информации. Он показывает только файл при загрузке. Кажется, нет ошибок. – Batbayar
Если ваш код работает локально, но не работает на вашем хосте, он должен быть чем-то связан с конфигурацией удаленного сервера - возможно, PHP.ini, возможно, .htaccess, возможно, разрешения, возможно, даже версия PHP - слишком много потенциальные причины. Я думаю, вам нужно будет найти способ просмотра журналов сервера, чтобы сузить причину. –