Permission for session directory

2019-07-16 18:27发布

问题:

I am facing an issue with my server that php session is not able to store data. Now, I changed my session directory permission to 777. Can any one confirm that this permission is correct and secure?

回答1:

As user prehfeldt said, "correct and secure" depends on the context. The important thing is that as I understand from your question, you have customized the directory where php sessions are saved. This is a good practice, especially if you are on shared hosting. Since the sessions directory is not placed in your public folders (making it accessible to anyone), the permissions you set should not be a problem.

Anyway, minimum permissions needed are read/write permissions for the user that represents the server (usually for apache apache runs with owner & group www-data, but this might not be the case with all linux servers distributions).