0

In a PHP membership website hosted in shared hosting, the session used to timeout in 30 minute after closing browser. We solve that problem by creating users.ini file and creating folder 'session' in public_html.

In users.ini file session.cookie_lifetime, session.gc_maxlifetime was extended also session.save_path was set to new directory path. The values of session.cookie_lifetime, session.gc_maxlifetime and session.save_path also set in each PHP program.

These are some queries that I have in this regard.

  1. The session files that are created in session folder have permission 0600 which means it cannot be assessed by anyone. Should we need to worry about session files?

  2. Is it possible to have session folder above public_html this case?

  3. The session folder gets populated with session files for each user visit to website. How to remove empty session files that are no longer needed when user leaves website?

3
  • 1
    In general, this is terrible idea, don't do it. More specifically, if your PHP app can read the files, and you're using Apache with mod_php, then Apache can read the files too. Have you tried requesting an existing session file on a URL like yourdomain.com/session/<session id> Commented 11 hours ago
  • 1
    Given this file can be read by every single site visitor, I would call "cannot be assessed by anyone" a bit of a stretch. Commented 11 hours ago
  • @AlexHowansky The session files are being saved as sess_1234. It is showing you don't have permission to access this resource when visit yourdomain.com/session/sess_1234 However, I was able to change session folder above public_html and it is working. Is there anything to worry after storing session above public_html? Commented 9 hours ago

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.