共享网络托管上的网络服务器可写入哪些目录?

发布于 2024-08-22 01:32:40 字数 316 浏览 4 评论 0原文

目前我正在使用共享网络主机 (Linux) 来托管我的网站。我知道“~/home/my_user_name/www”目录中的任何内容都可以由服务器写入。其他地点是什么?基本上我想更改默认会话存储位置,可能我不应该将其放在 www 目录中。

编辑

由于会话是由 PHP 进程保存的,会话保存位置是否必须是 Web 服务器可写的?

编辑2

我如何在/home/my_user_name/tmp目录上向Apache授予读+写权限(tmp目录位于www目录之外)?

Currently I'm using shared webhost (Linux) to host my site. I know that anything inside '~/home/my_user_name/www' directory is writable by server. What are the other locations? Basically I want to change default session storage location and probably I shouldn't put it inside www directory.

Edit

Does session saving location has to be web server writable, since session is saved by PHP process?

EDIT 2

How could I give read+write privilege to Apache on /home/my_user_name/tmp directory (tmp dir is outside www directory)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

長街聽風 2024-08-29 01:32:40

httpd 服务器可写的目录没有真正的“标准”:这完全取决于拥有该目录的用户授予的访问权限。

临时会话文件通常存储在 /tmp 目录中,该目录通常可由任何人写入 - 但这意味着您的会话文件将位于使用同一服务器的其他应用程序和用户可以访问的目录中和你一样。

当您从 /home/my_user_name/www 目录运行应用程序时,解决方案可能是创建另一个目录,例如 /home/my_user_name/tmp,并给出Apache 对此目录具有读+写权限——然后配置您的 application/php,以便将会话文件存储在此处。

另一种解决方案是将会话数据存储在数据库中:您的服务器上的其他用户和应用程序可能无法访问您的数据库。

There is no real "standard" for directories that could be writable by the httpd server : it all depends on which access-rights have been given by the user who owns the directories.

Temporary session files are generally stored in the /tmp directory, which is generally writable by anyone -- but this means your sessions files will be in a directory accessible by other applications and users that are using the same server as you.

As you are running your application from the /home/my_user_name/www directory, a solution might be to create another directory, such as /home/my_user_name/tmp, and give read+write privilege to Apache on this directory -- and, then, configure your application/php so that session files are stored there.

Another solution would be to store the session data in a database : chances are you have a database that other users and applications on your server can't access.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文