I am trying to save sessions outside of the web root. my website root folder is
public_html -> example.com
The sessions folder i have created is a sibling of the public_html folder. I don’t know how to reach it. I tried below but i get an error.
session.save_path = /sessions;
How do i solve this?
The path you give needs to be in quotes; that may be all that’s wrong here:
You mentioned that “the sessions folder is a sibling of public_html” so I’m assuming that
public_htmlis actually at the top-level of your filesystem. This would be unusual, though. Are you sure there is not more to the path? (You can double check by runningpwd -Pwhile in the directory, if you’re using a UNIX-like system. You’ll get back the full path to the directory.)You also don’t need a semicolon. That semicolon makes me a little wary, though: are you adding that configuration to your
php.inifile? It’s not something you’d add to just any piece of PHP code.If you don’t have access to
php.iniand still need to change the save path, see session_save_path in the manual.