Welcome Guest, Not a member yet? Register   Sign In
session_start(): Failed to initialize storage module
#1

Just one small problem. When I run the code on AWS server I get this error:
<p>Severity: Warning</p>
<p>Message:  session_start(): Failed to initialize storage module: user (path: /app/application/cache)</p>
<p>Filename: Session/Session.php</p>
<p>Line Number: 143</p>

Any idea what this is and how to fix it? This is a brand new server setup. I am thinking that perhaps I don't have the ability to write to /app/application/cache? 

My settings in config.php are:

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'cisession';
$config['sess_expiration'] = 28800;  // this is 8 hours, every 8 hours the session will be destroyed and when it does the user will be logged off
//$config['sess_expiration'] = 0;    //default to 7200  In addition to this if a user doesn't have any activity in 30 minutes, they will log off via javascript_funcs.js
$config['sess_save_path'] = APPPATH.'cache';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;


I am using CI3
proof that an old dog can learn new tricks
Reply
#2

(01-17-2021, 04:53 AM)richb201 Wrote: Any idea what this is and how to fix it? This is a brand new server setup. I am thinking that perhaps I don't have the ability to write to /app/application/cache? 

You’re right, it’s probably because the cache directory doesn’t have the right permissions. Make sure it is writable. If this is on Linux or macOS, you can change the permissions with “chmod 755 cache”. Google “chmod” for more informations. You can also read the section on file persmissions in this article I wrote: https://includebeer.com/en/blog/the-chec...list-chmod
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#3

Thanks. I am trying to setup to use Putty but it fails with "unable to open ppk file". So I checked out the rights on the ppk file. It seems that I am not the owner so i can't modify the rights. I know from your article that I need to change the right with chmod. But i can't since i am not the owner. How can I change the rights on a file that I don't own?
proof that an old dog can learn new tricks
Reply
#4

You can't unless you're the admin. If that's the case, on Linux you can use sudo.

But I'm not sure I understand your problem with Putty. I never heard of problems with ppk file. Putty is just a .exe, there's no need for administrator's rights.

And I missed the part where you are using AWS. Check which user is the owner of the files and directories, and check which user run the web server. Depending on your setup you may have the web server running under the "apache" user, or something else, and the files be owned by you. If that's the case, you need to give the write permission to the group, not just the owner with chmod 775, instead of 755. And make user both users are member of that group (user owning the files and user running the web server process).
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#5

(This post was last modified: 01-18-2021, 05:09 PM by richb201.)

I managed to get in by using chown. yeah! thx. Isn't there a nice UI in Putty? Or is that some other application? Anyway, looking at app/application/cache I see these permissions: drwxr-xr-x  2 ec2-user ec2-user 8.0K Jan 18 12:40 cache

ec2-user is the user I log in with in Putty. Can I assume that I need drwxrwxrwx  ? Is that 755 for the dir?
proof that an old dog can learn new tricks
Reply
#6

Awesome!  Cool
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#7

(This post was last modified: 01-18-2021, 06:21 PM by richb201.)

I ran chmod 755 cache and now the permissions are

drwxr-xr-x  2 ec2-user ec2-user 8.0K Jan 18 12:40 cache

which is the same as before. What am I doing wrong?

PS

I changed it to 777 (against your advice) and that seemed to take care of it.
proof that an old dog can learn new tricks
Reply
#8

What the user running the web server process (apache, httpd or something else?). If it's not ec2-user, you need to change the group for something that both users are a membre of. The last resort solution is to set the permission to 777 but I don't recommend that, especially on shared hosting...
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply




Theme © iAndrew 2016 - Forum software by © MyBB