CodeIgniter 3 closing session warning on unlink session file - php

I'm using CodeIgniter 3 to develop a web app and Ion Auth to manage users' login and logout, I'm using it on localhost on Windows. On logout I got this warning:
Severity: Warning
Message: unlink(
my_path_to_sessions\ci_session04c5acf96846fedf1fa448278e16a4006f6a10a0): Permission denied Filename: drivers/Session_files_driver.php Line
Number: 303
My Session_files_driver at line numbers 302-304:
return file_exists($this->_file_path.$session_id)
? (unlink($this->_file_path.$session_id) && $this->_cookie_destroy())
: TRUE;
In my config file I've set:
$config['sess_save_path'] = APPPATH.'sessions/';
I've also changed permissions for sessions folder.
What's the problem?

I have added the constructor in controller
public function __construct()
{
parent::__construct();
}
which causing this issue so I have removed it and now it's working like charm.

Related

I am facing a issue in my project which is created in codeigniter,

I am facing a issue in my project which is build in codeigniter, I am facing auto-logout problem and when I see log(error-log) file I found error the error are following:-
ERROR - 2017-11-15 16:15:50 --> Severity: Warning --> unlink(X:\xampp\tmp\ci_sessionboq544svmdme7blb7djjh1h92tnflmk7): Permission denied X:\xampp\htdocs\nabet-bmo\Code_v1\system\libraries\Session\drivers\Session_files_driver.php 320
ERROR - 2017-11-15 16:15:50 --> Severity: Warning --> session_regenerate_id(): Session object destruction failed X:\xampp\htdocs\nabet-bmo\Code_v1\system\libraries\Session\Session.php 720
Please help to resolve this problem
In the config.php file you MUST set sess_save_path to a valid path. It was initially set to NULL. I have mine set to:
Now the sessions are being saved in this folder and can be unlinked when needed to
change application > config > config.php
$config['sess_save_path'] = BASEPATH . 'cache/';

Troube with migrate an codeigniter system

I'm trying to migrate an codeigniter system for my localhost, but i'm receiving this message:
A PHP Error was encountered
Severity: Notice
Message: Only variable references should be returned by reference
Filename: core/Common.php
Line Number: 257
Fatal error: Class 'CI_Controller' not found in C:\xampp\htdocs\sistema-emisa\system\core\CodeIgniter.php on line 233
I've download the following pages from the host:
application ~
public_html ~
system
I changed the enters of the BD for the corrects on my localhost but still didnt work. I have to do some setting or download something else?
The server have this estructure:
One quick fix needs to be done.
Go to your system/core/Common.php file.
And search for return $_config[0] =& $config;
and replace this content with either of the following two snippets:
$_config[0] =& $config;
return $_config[0];
OR
return isset($_config[0][$item]) ? $_config[0][$item] : NULL;
Both of the above given pieces of codes will work.

CodeIgniter CI Session Error

Am using CodeIgniter for my application, my application working fine, but after sometime, when I reload any page than am getting ci_session error.
Please any one help me to solve this issue...
A PHP Error was encountered
Severity: Warning
Message: unlink(/tmp/ci_session074b4d178c387273e3eee244a10cdbafce7e337e
[function.unlink]: Operation not permitted
Filename: drivers/Session_files_driver.php
Line Number: 371
Backtrace:
File: /home/applic/public_html/workshop/application/controllers/Reports.php
Line: 7
Function: __construct
File: /home/applic/public_html/workshop/index.php
Line: 292
Function: require_once
In the config.php file you MUST set sess_save_path to a valid path. It was initially set to NULL.
$config['sess_save_path'] = BASEPATH . 'cache/';
if you create a folder 'sessions' and put it in your application folder you can use this:
$config['sess_save_path'] = APPPATH.'/sessions'

Unable to create file sys_get_temp_dir()

During the execution of a project in PHP ( CodeIgniter ) I get this error.
It corresponds to that line of code in the file Session_files_driver.php of CodeIgniter.
Previously I worked on Linux, but since I passed under W10, I get this error.
Thanks for your help.
A PHP Error was encountered
Severity: Warning
Message: touch(): Unable to create file
sys_get_temp_dir()\ci_sessionc1e70147453a4c2aa17523a19927bce80ef4afe9
because No such file or directory
Filename: drivers/Session_files_driver.php
Line Number: 234
Backtrace:
if (($this->_file_handle = fopen($this->_file_path.$session_id, 'w+b')) === FALSE)
It appears that you've provided 'sys_get_temp_dir()' as a string (note the quotes) for your sess_save_path value. It's a function, you're not supposed to put quotes around it.
Also, it's a bad idea to use the system-wide temporary directory for your session files' location. That directory is readable by everybody, which means that any other user on the system can read your users' session data - you must avoid that!
Most likely a write permission error. Grant apache user the permission to write to disk.

Could not found load model total/subtotal OpenCart

Suddenly I started to recieve the below error when tring to access mysite.com after installing opencart. I kindly request your help on how to solve this ...
Notice: Error: Could not load model total/sub_total! in /home/xxxxx/public_html/system/engine/loader.php on line 37
Steps to try :
Check whether this file exists: catalog\model\total\sub_total.php.
Verify the file permission of catalog\model\total\sub_total.php.

Categories