Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change session_save_path in php.ini file?

I have a shared hosting on godaddy.

I tried to change session save path in php.ini file with this line,

sessions.save_path = "/session"

I've controlled the sessions save path with sessions.save_path() function. It returns /tmp before and after changing php.ini

Is it possible to change session save path on shared hosting?
Where am I wrong?

like image 266
Okan Kocyigit Avatar asked Jan 19 '12 14:01

Okan Kocyigit


1 Answers

You can modify the session save path on shared hosting by creating a custom php.ini.

Include this in your file: session.save_path = "/path/to/your/folder"

Otherwise, you can use:

ini_set('session.save_path', '/path/to/your/folder')

The folder you use should be under your domain/account but not accessible through a Web browser. It also needs to have world-writable permissions on it. And every page that uses sessions must include that line.

like image 93
Mughil Avatar answered Sep 22 '22 21:09

Mughil