Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeigniter PHP Warning

Following error message is being logged in my codeigniter application :

PHP Warning:  include(application/errors/error_php.php): failed to open stream: No such file or directory in /usr/src/dv/system/core/Exceptions.php on line 167, referer: http://localhost/dc

When I open the /usr/src/dv/system/core/Exceptions.php I get following on line 167 :

include(APPPATH.'errors/error_php.php');

The value of APPPATH is application/

If I appent the absolute path, ie include('/usr/src/mypath'.APPPATH.'errors/error_php.php'); it is working fine.

What should I do about it ? Please suggest. I am new to code-igniter.

like image 990
piyush Avatar asked Dec 03 '22 03:12

piyush


2 Answers

I was not happy with this answer, you should not have to change php.ini for this work.

I tried to find out why the cwd (current working directory) was being reset and if this was different in newer version of php, but couldn't find anything that was useful.

However since the core still had access to APPPATH I simply changed the line in my index.php file to

$application_folder = getcwd().'/../application';

This should allow your code to be transportable still.

like image 127
Shaun Forsyth Avatar answered Jan 03 '23 11:01

Shaun Forsyth


This is not a Codeigniter problem at all. You don't have your include_path set up correctly in php.ini. Basically, the include_path gives PHP a number of different directories to look in when including files.

http://www.php.net/manual/en/ini.core.php#ini.include-path

like image 36
Ian Atkin Avatar answered Jan 03 '23 13:01

Ian Atkin