[php] CodeIgniter : Unable to load the requested file:

Hi I’m just new in codeigniter. My website works locally, but when I uploaded it, I got this error:

An Error Was Encountered Unable to load the requested file: home\home_view.php

Here is my controller:

<?php
class home extends CI_Controller{

function index(){

  $data=array();
  if($query=$this->home_model->get_dynamic_main_menu())
  {
  $data[‘main_menu’] = $query;
  }

  $this->load->view(‘home\home_view’,$data);
}


}

Thanks!

This question is related to php codeigniter web-hosting

The answer is


I was getting this error in PyroCMS.

You can improve the error message in the Loader.php file that is in the code of the library.

Open the Loader.php file and find any calls to show_error. I replaced mine with the following:

show_error(sprintf("Unable to load the requested file: \"%s\" with instance title of \"%s\"", $_ci_file, $_ci_data['_ci_vars']['options']['instance_title']));

I was then able to see which file was causing the issues for me.


An Error Was Encountered Unable to load the requested file:

Sometimes we face this error because the requested file doesn't exist in that directory.

Suppose we have a folder home in views directory and trying to load home_view.php file as:

$this->load->view('home/home_view', $data);// $data is array

If home_view.php file doesn't exist in views/home directory then it will raise an error.

An Error Was Encountered Unable to load the requested file: home\home_view.php

So how to fix this error go to views/home and check the home_view.php file exist if not then create it.


"Unable to load the requested file"

Can be also caused by access permissions under linux , make sure you set the correct read permissions for the directory "views/home"


I error occor. When you are trying to access a file which is not in the director. Carefully check path in the view

 $this->load->view('path');

default root path of view function is application/view .

I had the same error. I was trying to access files like this

 $this->load->view('pages/view/file.php');

Actually I have the class Pages and function. I built the function with one argument to call the any files from the director application/view/pages . I was put the wrong path. The above path pages/view/files can be used when you are trying to access the controller. Not for the view. MVC gave a lot confusion. I had this problem. I just solve it. Thanks.


File names are case sensitive - please check your file name. it should be in same case in view folder


try $this->load->view('home/home_view',$data);

instead of this:

$this->load->view(‘home\home_view’,$data);


Examples related to php

I am receiving warning in Facebook Application using PHP SDK Pass PDO prepared statement to variables Parse error: syntax error, unexpected [ Preg_match backtrack error Removing "http://" from a string How do I hide the PHP explode delimiter from submitted form results? Problems with installation of Google App Engine SDK for php in OS X Laravel 4 with Sentry 2 add user to a group on Registration php & mysql query not echoing in html with tags? How do I show a message in the foreach loop?

Examples related to codeigniter

DataTables: Cannot read property 'length' of undefined How to set time zone in codeigniter? php codeigniter count rows CodeIgniter: 404 Page Not Found on Live Server Only variable references should be returned by reference - Codeigniter How to pass a parameter like title, summary and image in a Facebook sharer URL How to JOIN three tables in Codeigniter how to get the base url in javascript How to get id from URL in codeigniter? How to disable PHP Error reporting in CodeIgniter?

Examples related to web-hosting

Unable to negotiate with XX.XXX.XX.XX: no matching host key type found. Their offer: ssh-dss How to host a Node.Js application in shared hosting Uploading Laravel Project onto Web Server CodeIgniter : Unable to load the requested file: A default document is not configured for the requested URL, and directory browsing is not enabled on the server Viewing my IIS hosted site on other machines on my network How to redirect siteA to siteB with A or CNAME records