• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
path error in exception.php

#1
[eluser]bgreene[/eluser]
in a controller if i use chdir('E:\website\codeigniter20\') and then this.load.view(diag) i get the warnings attached to the end of this because ci has lost its bearings.
to solve the problem, i need to make the paths in exception.php absolute ie
line 131
// include(APPPATH.'errors/'.$template.EXT);
include('E:/website/CodeIgniter20/ci_application/errors/'.$template.EXT);
line 167
// include(APPPATH.'errors/error_php'.EXT);
include('E:/website/CodeIgniter20/ci_application/errors/error_php.php');
now it reports unable to load file diag.php which makes more sense
would be even better if it gave the full path of the file it is trying to load.

*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Warning: CI_Exceptions::include(../ci_application/errors/error_php.php) [ci-exceptions.include]: failed to open stream: No such file or directory in E:\website\CodeIgniter20\ci_system\core\Exceptions.php on line 169
Warning: CI_Exceptions::include() [function.include]: Failed opening '../ci_application/errors/error_php.php' for inclusion (include_path='.;C:\php5\pear') in E:\website\CodeIgniter20\ci_system\core\Exceptions.php on line 169
Warning: CI_Exceptions::include(../ci_application/errors/error_php.php) [ci-exceptions.include]: failed to open stream: No such file or directory in E:\website\CodeIgniter20\ci_system\core\Exceptions.php on line 169
Warning: CI_Exceptions::include() [function.include]: Failed opening '../ci_application/errors/error_php.php' for inclusion (include_path='.;C:\php5\pear') in E:\website\CodeIgniter20\ci_system\core\Exceptions.php on line 169
include('E:/website/CodeIgniter20/ci_application/errors/error_php.php');
// include(APPPATH.'errors/error_php'.EXT);

#2
[eluser]terdelyi[/eluser]
Yes, I absolutely confirm too: this error is exist, and modifying the path solved it.

#3
[eluser]InsiteFX[/eluser]
You should not be editing a CI core file!
You extend the CI core Class
Code:
// place in application/core/MY_Exceptions.php
class MY_Exceptions extends CI_Exceptions {

}

InsiteFX

#4
[eluser]terdelyi[/eluser]
Yes, it shouldn't if it would work normally!
When a patch is coming out you have to rewrite the modified Exceptions.php anyway, but you're right extend the core class is a more elegant way.

#5
[eluser]stuffradio[/eluser]
What are you trying to solve exactly that would require editing the exception.php file?

#6
[eluser]Unknown[/eluser]
I am having the same issue. The reason most people are not seeing this error is because they are running CI at the root level of their web server. In my case, it's in a directory under the root.

The problem seems to be that index.php defines the constant APPPATH to:

// The path to the "application" folder
if (is_dir($application_folder))
{
define('APPPATH', $application_folder.'/');
}

In my case, this sets APPPATH to "application/". (note how that's not a fully-qualified path), and that would not naturally be in the include_path, since "application" is in a folder underneath the web root.

So, when Exception.php tries to load the file,
include(APPPATH.'errors/error_php'.EXT);

...that path does not exist, so it throws an error:

[04-Jun-2011 05:26:24] PHP Warning: include() [<a href='function.include'>function.include</a>]: Failed opening 'application/errors/error_php.php' for inclusion (include_path='') in ...[snip].../ci/system/core/Exceptions.php on line 167

Seems like an easier solution to the class override you suggest above would just be to put the actual CI directory in the include_path in php.ini.

Nevertheless, the coding in index.php is clearly a bug. Can someone file it and hopefully fix it in the future?

#7
[eluser]stormbytes[/eluser]
I confirm. Same error... no apparent reason.

EDIT: FOund a hack that fixes this... It's *always* a bad idea to edit core files, but in this case the problem seems to be triggered by sessions calls (a php error and not necessarily a CI issue).

Anways... if you want to venture into the hack-world, read this:

https://bitbucket.org/ellislab/codeignit...ng-session

#8
[eluser]ctepeo[/eluser]
line 75 at index.php should look like

Code:
$application_folder = dirname(__FILE__).DIRECTORY_SEPARATOR.'application';

Have a good day Smile

#9
[eluser]PhilTem[/eluser]
[quote author="ctepeo" date="1340738645"]line 75 at index.php should look like

Code:
$application_folder = dirname(__FILE__).DIRECTORY_SEPARATOR.'application';

Have a good day Smile[/quote]

That is a solution, however you'd really want to use

Code:
define('APPPATH', realpath($application_folder) . '/');

to really fix the problem (line 182) since it solves the problem robustly Wink

#10
[eluser]ctepeo[/eluser]
[quote author="PhilTem" date="1340740762"]
That is a solution, however you'd really want to use

Code:
define('APPPATH', realpath($application_folder) . '/');

to really fix the problem (line 182) since it solves the problem robustly Wink[/quote]

yeah, You're right, thanks


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.