1
votes

i have Codeigniter v202, and php version 5.2.17 my site works just good in my local but in the server i keep getting this error message in everypage, message in error log is:

PHP Fatal error: Call to a member function cookie() on a non-object in /path/to/libraries/Session.php on line 138

and in page i have

A PHP Error was encountered

Severity: Notice

Message: Undefined property: MY_CONTROLLER_NAME::$input

Filename: libraries/Session.php

Line Number: 138

this is line 138:

$session = $this->CI->input->cookie($this->sess_cookie_name);

library is the original, i didnt make any changes on it. please help!

1
Please provide relevant code to your problem so that we can help you with it.Kemal Fadillah
Why $this->CI? where are you working? a regular controller? did you call the parent __construct()?Damien Pirsy
it is CI's own session library, and same error in all controllersmumin aydin
I think you're getting something wrong, reading the "undefined property" error you posted. Could you please write more of the code you're using, and where? Are you extending the library or just calling it in the controller?Damien Pirsy
@DamienPirsy i got the error in any controller and the function even to echo 'phpinfo()' with CI controller i got the error message. i thought there was something wrong with my autoload models but i remove them still the same issue.mumin aydin

1 Answers

2
votes

I found what was wrong. i had

setlocale(LC_ALL, 'tr_TR');

in my /index.php. so weird but session library did not initialize core input. it took me long to find but when i echo

echo var_dump($this->CI);

there was ? (question mark) instead of the char I then it was ?nput. my locale didn't capitalize char i as I, that was the problem. weird thing is it worked in localhost but didn't work on the server.