(03-05-2016, 08:45 AM)n2fole00 Wrote: Hi, I've just uploaded my first ci app to my host provider's server after working on it in apache's localhost. The welcome controller worked fine, but when I tried to access my ion auth login, I got the following error...
Code:
A PHP Error was encountered
Severity: Warning
Message: mkdir(): Invalid path
Filename: drivers/Session_files_driver.php
Line Number: 117
Backtrace:
File: /home/leke/public_html/ci/application/core/MY_Controller.php
Line: 9
Function: library
File: /home/leke/public_html/ci/application/core/MY_Controller.php
Line: 52
Function: __construct
File: /home/leke/public_html/ci/application/controllers/admin/Dashboard.php
Line: 9
Function: __construct
File: /home/leke/public_html/ci/index.php
Line: 292
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/leke/public_html/ci/system/core/Exceptions.php:272)
Filename: core/Common.php
Line Number: 568
Backtrace:
An uncaught Exception was encountered
Type: Exception
Message: Session: Configured save path '' is not a directory, doesn't exist or cannot be created.
Filename: /home/leke/public_html/ci/system/libraries/Session/drivers/Session_files_driver.php
Line Number: 119
Backtrace:
File: /home/leke/public_html/ci/application/core/MY_Controller.php
Line: 9
Function: library
File: /home/leke/public_html/ci/application/core/MY_Controller.php
Line: 52
Function: __construct
File: /home/leke/public_html/ci/application/controllers/admin/Dashboard.php
Line: 9
Function: __construct
File: /home/leke/public_html/ci/index.php
Line: 292
Function: require_once
After a little googling, I found adding changing $config['sess_save_path'] from NULL to sys_get_temp_dir(); in config.php fixed the problem. Reading up on this led me to https://www.codeigniter.com/user_guide/l...sions.html and there it was suggested I load $this->load->library('session'); after parent::__construct() in MY_Controller. Trying this (after setting $config['sess_save_path'] back to NULL) gave me an error again, so I'm back to the sys_get_temp_dir(); as the value to $config['sess_save_path'].
So my question is, is this a usual thing when setting up the live app environment, or should I be concerned about something at this stage? As a noob, it's quite hard to ask questions about something I am new to, but I'm just trying to make sure I'm not going too far off track here while trying to understand as much as possible.
Thanks.
https://github.com/bcit-ci/CodeIgniter/b...g.php#L347
Why did you ignore this note?
You're not supposed to leave it empty.
And you are again NOT supposed to set it it to sys_get_temp_dir(), especially if you're uploading to a shared hosting environment.
Just pick a directory that only
you can read, and point to it.
(03-05-2016, 12:37 PM)iz_no_good Wrote: i remember i had similar problem with my app when uploaded to the hosting server. i guess the problem comes from the caged virtual FS that you see on the hosting server, while you see path /htdocs/session_path , the real path is, for example: /var/<username>/htdocs/session_path.
what i finally did to overcome this, is:
the prod installation has in index.php:
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'production');
while the installation on my dev PC has:
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
so, remove completely the line about sess_path line from the application/config.php file and define the path (use absolute path, i could see the absolute path in the log, i dont see it in your case, you will have to discover it somehow, maybe even ask the server admin) on each file (config/production/config.php and config/development/config.php), and by changing the ENVIRONMENT in the index.php, you can make CI load the path you need per system. before all that, i had relevant path (../xxx/xxx/session_path for example), but when i migrated to the hosting server, i ended up in the above trouble and had to switch to absolute paths.
hope it helps
This has
nothing to do with the OP's question and you're giving a very bad advice.