Linux 不允许 chmod() 操作 - FatFree 框架
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9769266/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
chmod() operation not permitted - FatFree framework
提问by Siddharth
I have been developing an app in FatFree framework and now I am trying to deploy it on a server. Everything seems to be fine when I am running it on localhost.
我一直在用 FatFree 框架开发一个应用程序,现在我正在尝试将它部署在服务器上。当我在本地主机上运行它时,一切似乎都很好。
However, when I have deployed it on the server and trying to access it, it gives me a strange error which is -
但是,当我将它部署在服务器上并尝试访问它时,它给了我一个奇怪的错误,即 -
Internal Server Error
chmod(): Operation not permitted
#0 /var/www/webapp/inc/main.php:62 Template::serve('front_page.php')
#1 /var/www/index.php:65 F3::run()
I have given 777 permissions to the webapp
folder so chmod()
should be allowed. The above suggests that there is an error while serving the template file front_page.php
.
我已为该webapp
文件夹授予 777 权限,因此chmod()
应该允许。以上表明提供模板文件时出现错误front_page.php
。
How can I fix this?
我怎样才能解决这个问题?
采纳答案by jpic
Check intermediary directories permissionsIt's a common gotcha.
检查中间目录权限这是一个常见的问题。
回答by Learner
For this you have to give the permissions recursively using -R for your "webapp" folder
为此,您必须使用 -R 为“webapp”文件夹递归授予权限
回答by user79382
You can add write permissions for web-server to your [fatfree-web-root-dir]. Not safe!
您可以将 web-server 的写入权限添加到您的 [fatfree-web-root-dir]。不安全!
chmod o+w fatfree-web-root-dir # Then web-server can create "temp" folder.
An other way: You must create "temp" directory with web-server owner:
另一种方式:您必须使用网络服务器所有者创建“临时”目录:
mkdir fatfree-web-root-dir/temp
chown www-data:www-data fatfree-web-root-dir/temp
# www-data - in Debian for example
回答by lubar
Siddharth alludes to the correct answer in the comments:
悉达多在评论中提到了正确答案:
F3 compiles templates to a temp/ dir before serving. This temp dir needs to a) exist and b) have appropriate permissions.
F3 在服务之前将模板编译到临时/目录。此临时目录需要 a) 存在且 b) 具有适当的权限。
To achieve this, go the dir where your template file exists and run:
为此,请转到模板文件所在的目录并运行:
mkdir temp/
chown www-data temp