Welcome Guest, Not a member yet? Register   Sign In
Can't figure this issue out. Has to do with the CI_Exception class
#1

[eluser]kyleect[/eluser]
When I run my default controller, I get this error message:

Code:
Warning: CI_Exceptions::include(application/errors/error_php.php) [function.CI-Exceptions-include]: failed to open stream: No such file or directory in /Users/kyleetilley/htdocs/_firestarter_dev/system/libraries/Exceptions.php on line 161

Warning: CI_Exceptions::include() [function.include]: Failed opening 'application/errors/error_php.php' for inclusion (include_path='.:/Applications/MAMP/bin/php5/lib/php') in /Users/kyleetilley/htdocs/_firestarter_dev/system/libraries/Exceptions.php on line 161

Warning: CI_Exceptions::include(application/errors/error_php.php) [function.CI-Exceptions-include]: failed to open stream: No such file or directory in /Users/kyleetilley/htdocs/_firestarter_dev/system/libraries/Exceptions.php on line 161

Warning: CI_Exceptions::include() [function.include]: Failed opening 'application/errors/error_php.php' for inclusion (include_path='.:/Applications/MAMP/bin/php5/lib/php') in /Users/kyleetilley/htdocs/_firestarter_dev/system/libraries/Exceptions.php on line 161

This is off a clean install. The only thing I've done is move the Application folder in the same folder as the system folder and created a MY_Controller library file that has the following contents:

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
* MY_Controller
*
* Consider this the application controller.
*
* @package Firestarter
* @subpackage Core Extension
* @author Kylee Tilley <[email protected]>
*/

// ------------------------------------------------------------------------

/**
* @package Firestarter
* @subpackage Core Extension
**/

/*

    NOTE: Using this controller will change how you are using views.
    You will need to load a view in to a variable called $this->views['content']

*/

    class MY_Controller extends Controller
    {
        protected $view_data;
        protected $assests;
        protected $views;
        
        public function __construct()
        {
            parent::Controller();
            
            $this->config->load('application', TRUE);        
            
            
            
            //SET DEFAULT VIEW VARIABLES
            $this->view_data['page_title'] = 'Home';
            $this->view_data['application'] = $this->config->item('application');
                //To help standardize page specific CSS, we are setting the body id of the page to "controller__method"            
            $this->view_data['body_id'] = ($this->router->method = 'index') ? ($this->router->class) : ($this->router->class).'__'.(($this->router->method));
            
            //SET DEFAULT ASSESTS
            $this->assests['css'] = 'dd';
            $this->assests['javascript'] = NULL;

            //LOAD VIEWS
            //The header and footer views have to be loaded in to variables so they can be outputted on the controllers destruction
            $this->views['header'] = $this->load->view('header', $this->view_data, TRUE);
            $this->views['footer'] = $this->load->view('footer', $this->view_data, TRUE);
            $this->views['view_content'] = NULL;
        }
        
        private function embed_assests()
        {
            if(!is_null($this->assests['css']))
            {
                foreach($this->assests['css'] as $stylesheet)
                {
                    $temp = '&lt;link rel="stylesheet" href="'.(base_url()).'/assests/'.$stylesheet.'.css" type="text/css"&gt;';
                }
                $this->views['header'] = str_replace('#load_css#', $temp, $this->views['header']);
            }
            else
            {
                $this->views['header'] = str_replace('#load_css#', '', $this->views['header']);
            }
            
            if(!is_null($this->assests['javascript']))
            {
                foreach($this->assests['javascript'] as $javascript)
                {
                    $temp2 = '[removed][removed]';
                }
                
                $this->views['header'] = str_replace('#load_javascript#', $temp2, $this->views['header']);
            }
            else
            {
                $this->views['header'] = str_replace('#load_javascript#', '', $this->views['header']);
            }
        }
        
        public function __destruct()
        {
            $this->embed_assests();
            
            echo $this->views['header'];
            echo $this->views['view_content'];
            echo $this->views['footer'];
        }
    }
?&gt;

I checked all the files it says it can't find and they are there. I'm running php 5 on MAMP if that helps. Does any one know how to help?
#2

[eluser]sophistry[/eluser]
did you set the system and application dir names in config.php? [strike]the error says it is looking for the file at application/errors/error_php.php. this may sound like a dumb question, but, is there a file there?[/strike]

EDIT: i just noticed you said you checked all the files... but, since you said you moved application... maybe CI is confused about where it is looking. a relative file path that starts application/errors... is determined by the PWD. use getcwd() to see which directory CI is running "in" - usually it is where you've got index.php.

cheers.
#3

[eluser]InsiteFX[/eluser]
You also need to set the system and application directories in index.php.

Enjoy
InsiteFX
#4

[eluser]kyleect[/eluser]
Ok, this turned out to be the issue. I've had the application folder outside of the system folder in the past and have never had any issue with errors. I have figured out a way around this however it's a little sloppy:

Code:
$application_folder = realpath(dirname(__FILE__)).'/'."application";

I wish CI natively was a little more flexible about moving your application folder. Do a lot of people keep it in the system folder?




Theme © iAndrew 2016 - Forum software by © MyBB