PHP 脚本:mkdir 权限被拒绝 - 处理客户支持的最佳方式?
我出售一个需要创建一些目录的 PHP 脚本。现在我知道我可以告诉用户将目录 chmod 为 777,但这似乎不太安全。还有另一种(安全)方法吗?这些是购买了 PHP 脚本的新手用户,所以我不能指望他们以不同的方式配置 apache,无论如何,大多数都在共享主机上。
该脚本正在创建用户提供的图像目录的缩略图。由于是 apache 创建文件,所以它可能需要 777?有没有什么方法可以让用户轻松完成 chmod 操作?
谢谢, 韦斯利
I sell a PHP script that needs to make some directories. Now I know that I can just tell the user to chmod the directory to 777, but that doesn't seem very secure. Is there another (safe) way? These are novice users that have bought a PHP script, so I cannot expect them to configure apache differently, most are on shared hosts anyway.
The script is creating thumbnails of an image directory the user supplies. Since it's apache that creates the files, it probably needs 777? Is there any way around chmod that is easy for users to do?
Thanks,
Wesley
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
[php 脚本应该在哪个路径中创建目录?]
你只需要该路径属于运行 php 脚本的用户,那么权限可以简单地为 700 而不是 777。
[Which path is the php script supposed to create directories into?]
You just need the path to belong to the user who runs the php script, then the permission could simply be 700 instead of 777.