Initially, I thought I had a problem with loading libraries due to using Modular Extensions inside Codeigniter.
However I have discovered even with a clean install o
I also run into this problem today.
Thank you Sparky and Trojka, setting my config to use database instead file made my CI app working perfectly, both on my local server and live one.
Here is how:
$config['sess_driver'] = 'database'; // changed from file
$config['sess_save_path'] = 'ci_sessions'; // table name
There is MySQL for table creation in link Trojka posted.
From CI3 Docs: By default, the Files Driver will be used when a session is initialized, because it is the most safe choice and is expected to work everywhere (virtually every environment has a file system).
So default thing works good on windows environment but on mac and linux systems I have faced similar issues.
Thing that worked for me without switching to Database:
Step 1: create session directory with proper permissions:
mkdir /<path to your application directory>/ci_sessions/
chmod 0700 /<path to your application directory>/ci_sessions/
chown _www /<path to your application directory>/ci_sessions/
Take care of apache username it varies like: www-data, _www, apache etc.
Step 2: Set absolute path for sess_save_path config: (Mine on Mac looked like below)
$config['sess_save_path'] ='/Library/WebServer/Documents/App/ci_sessions/';
Working code;
$config['sess_save_path'] = sys_get_temp_dir();
This allows to execute the script.
Message: Session: Configured save path '' is not a directory, doesn't exist or cannot be created.
$config['sess_save_path'] = NULL;
Try to set this one.
For me This one workred $config['sess_save_path'] = '/tmp';
Step1 : open config.php and create a session folder with 0755 permission.
Step2 : update below code variable
$config['sess_save_path'] = __DIR__.'/session';
This Code is working for on my MACOS for session error :
You need to add this code into config.php file
you need to replace NULL
with sys_get_temp_dir()
$config['sess_save_path'] = sys_get_temp_dir();
My error was :
Warning: Uncaught Exception: Session: Configured save path '' is not a directory, doesn't exist or cannot be created. in /Library/WebServer/Documents/ci/fuse/system/libraries/Session/drivers/Session_files_driver.php:138 Stack trace: #0 [internal function]: CI_Session_files_driver->open('', 'ci_session') #1 /Library/WebServer/Documents/ci/fuse/system/libraries/Session/Session.php(143): session_start() #2 /Library/WebServer/Documents/ci/fuse/system/core/Loader.php(1281): CI_Session->__construct() #3 /Library/WebServer/Documents/ci/fuse/system/core/Loader.php(1174): CI_Loader->_ci_init_library('Session', 'CI_', NULL, 'session') #4 /Library/WebServer/Documents/ci/fuse/system/core/Loader.php(1037): CI_Loader->_ci_load_stock_library('Session', 'Session/', NULL, NULL) #5 /Library/WebServer/Documents/ci/fuse/system/core/Loader.php(1082): CI_Loader->_ci_load_library('Session', NULL, NULL) #6 /Library/WebServer/Documents/ci/fuse/system/core/Loader.php(218): CI_Loader->_ci_load_library('Session', NULL, NULL) #7 /Library/WebServe in /Library/WebServer/Documents/ci/fuse/system/libraries/Session/drivers/Session_files_driver.php on line 138
Fatal error: session_start(): Failed to initialize storage module: user (path: ) in /Library/WebServer/Documents/ci/fuse/system/libraries/Session/Session.php on line 143