Problem with session files |
php filesize() function is Returns the size of the file in bytes, or false (and generates an error of level E_WARNING) in case of an error.
Ref: https://www.php.net/manual/en/function.filesize.php # Reason of error: I found two main reason of this error: 1. File doesn’t exist 2. File exist but file size is larger than 2GB which that’s why filesize() function can’t read that file. I found a problem in code codeigniter session driver source code “Session_files_driver.php”.There is no file_exists () Checks whether a file or directory exists on the directory. Please have a look on the system/libraries/Session/drivers/Session_files_driver.php line no 208 for ($read = 0, $length = filesize($this->_file_path.$session_id); $read < $length; I think the there should have checking if the file exist before try to read the file. # Solution: 1. Set absolute path on session file $config['sess_driver'] = 'files'; //$config['sess_save_path'] = NULL; $config['sess_save_path'] = '/var/lib/php/sessfiles/'; 2. Correct the session driver source code: if (file_exists($this->_file_path.$session_id)) { for ($read = 0, $length = filesize($this->_file_path.$session_id); $read < $length; $read += self: ![]() { if (($buffer = fread($this->_file_handle, $length - $read)) === FALSE) { break; } $session_data .= $buffer; } } Hope this will help you to solve this problem. Thank you
Every Problem Must have a Solution
![]() |
Messages In This Thread |
Problem with session files - by raffaele.bennoli - 11-22-2017, 02:18 AM
RE: Problem with session files - by PaulD - 11-22-2017, 12:17 PM
RE: Problem with session files - by raffaele.bennoli - 11-23-2017, 01:05 AM
RE: Problem with session files - by dave friend - 11-22-2017, 09:01 PM
RE: Problem with session files - by raffaele.bennoli - 11-23-2017, 01:09 AM
RE: Problem with session files - by dave friend - 10-30-2018, 11:41 AM
RE: Problem with session files - by clover - 10-21-2018, 02:57 PM
RE: Problem with session files - by InsiteFX - 10-24-2018, 09:08 AM
RE: Problem with session files - by shafiq2410 - 12-28-2021, 09:34 PM
RE: Problem with session files - by roben - 01-10-2022, 01:51 AM
|