【发布时间】:2012-07-14 07:11:59
【问题描述】:
我是个菜鸟,在 AWS 上学习 Yii 教程。到目前为止,我已经能够启动并运行所有内容 - 包括 mysql 连接。但现在我正在使用 Gii 代码生成工具来帮助创建一些模型类。这样做时,我收到以下错误:
generating models/User.php
Unable to write the file '/var/www/html/blog/protected/models/User.php'.
done!
文档还告诉我:
Info: Because the code generator needs to save the generated code into files, it is
required that the Web process have the permission to create and modify the corresponding
files. For simplicity, we may give the Web process the write permission to the whole
/www/blog directory. Note that this is only needed on development machines when using Gii.
这对我来说很有意义,并且我理解 Linux 权限的基本逻辑应用于用户和组......但不适用于进程。有人可以向我指出如何授予 Gii 进程对 webroot(在我的情况下为:/var/www/html/blog/)目录的写入权限吗?
【问题讨论】:
-
想补充一点,我已经阅读并理解在生产服务器上运行 Gii 的危险。但是,config/main.php 文件中的 ip 过滤器设置被设置为只允许从我的公共 IP 地址运行 Gii。所以运行一个实时的 AWS 实例(而不是 WAMP localhost)似乎仍然是安全的。
-
进一步更新:我犯了一个错误,在没有正确理解的情况下尝试快速修复并做了... chmod -R 0644 /var/www/html/blog/ ...我无法访问现在页面,这意味着我已经关闭了应用程序。 ...帮助!!
-
设置
755。 “进程”不需要权限,脚本需要,在本例中为Gii。但是,如果 apache 对文件夹具有读/写/执行访问权限 (7),它应该可以工作,前提是您在Gii配置中添加您的 IP。
标签: linux permissions yii gii