Reputation: 109
When open codeigniter project localhost they work properly and open in server then error of invalid path
A PHP Error was encountered
Severity: Warning
Message: mkdir(): Invalid path
Filename: drivers/Session_files_driver.php
Line Number: 117
Backtrace:
File: /Library/Server/Web/Data/Sites/garden_worx/index.php Line: 292 Function: require_once
Error 2
An uncaught Exception was encountered
Type: Exception
Message: Session: Configured save path '' is not a directory, doesn't exist or cannot be created.
Filename: /Library/Server/Web/Data/Sites/garden_worx/system/libraries/Session/drivers/Session_files_driver.php
Line Number: 119
Backtrace:
File: /Library/Server/Web/Data/Sites/garden_worx/index.php Line: 292 Function: require_once
Error 3
A PHP Error was encountered
Severity: Warning
Message: fopen(6d898f163e36616cef220426dad109225a66f74a): failed to open stream: Permission denied
Filename: drivers/Session_files_driver.php
Line Number: 156
Backtrace:
Upvotes: 7
Views: 31923
Reputation: 917
Change 'NULL' to either '/tmp' or your servers temp folder path
The line should now read:
$config['sess_save_path'] = '/tmp';
Upvotes: 1
Reputation: 1
adding 'session' in autoload.php file solved my problem
$autoload['libraries'] = array('form_validation','session');
Upvotes: -1
Reputation: 41
you can also put
output_buffering = On
in your php.ini file on the root
Upvotes: 0
Reputation: 41
This work for me
$config['sess_save_path'] = sys_get_temp_dir();
Upvotes: -2
Reputation: 19
Simply change this in your, application -> config -> config.php
$config['sess_save_path'] = NULL;
To
$config['sess_save_path'] = FCPATH.'ci_sessions';
It will create a Directory in your Root. Hopefully your problem will solve ...
Thanks
Upvotes: 2
Reputation: 959
This worked for me
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = sys_get_temp_dir();
$config['sess_match_ip'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
Upvotes: 0
Reputation: 713
This will be really helpful to you, it was save my day too :)
in your config.php
$config['sess_save_path'] = sys_get_temp_dir();
Similar Question session error in codeigniter?
Upvotes: 20
Reputation:
In codeigniter 3 versions you can use files or database if files, make sure you have created folder where you would like your session path set and chmod 700
I use cache folder to store files sessions
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 1440;
$config['sess_save_path'] = FCPATH . 'application/cache/sessions/';
$config['sess_match_ip'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = TRUE;
Auto load session in application > config > autoload
$autoload['libraries'] = array('session');
Note: Make sure all file names and class names of controllers, models, libraries have first letter upper case example filename
Welcome.php
andclass Welcome extends CI_Controller {}
.
Codeigniter doc's 2 and 3 http://www.codeigniter.com/docs
Codeigniter 3 session http://www.codeigniter.com/user_guide/libraries/sessions.html
Codeigniter 2 session: http://www.codeigniter.com/userguide2/libraries/sessions.html
You also may need to have a encryption_key on config.php
$config['encryption_key'] = 'pXeQY2733rR560MrwJy40OL4WaSGmr5A';
Upvotes: 12