PHP Codeigniter 错误无法打开流:权限被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18561628/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 17:48:05  来源:igfitidea点击:

PHP Codeigniter error failed to open stream: Permission denied

phpfilecodeigniterubuntupermissions

提问by Grigoruta Cristian

I have been working on a project that uses codeigninter. I worked on it in Windows 7 and it was fine but after I moved this project on Ubuntu to work on it there, It gives me this error in every page/controller/method that I try to access:

我一直在研究一个使用 codeigninter 的项目。我在 Windows 7 中处理它并且很好,但是在我将这个项目移到 Ubuntu 上之后,它在我尝试访问的每个页面/控制器/方法中都给了我这个错误:

Warning: require_once(/opt/lampp/htdocs/TS_Project/system/core/CodeIgniter.php): failed to open stream: Permission denied in /opt/lampp/htdocs/TS_Project/index.php on line 202

Fatal error: require_once(): Failed opening required '/opt/lampp/htdocs/TS_Project/system/core/CodeIgniter.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/TS_Project/index.php on line 202

The CodeIgniter.phpfile does exist, the path to it is correct and I am able to read and write in it ( I can open it in a text editor and modify it freely). I tried changing the file permission to it using the chmodcommand but nothing happens. Why is permission denied to the CodeIgniter.phpfile?

CodeIgniter.php文件确实存在,它的路径是正确的,我可以在其中读写(我可以在文本编辑器中打开它并自由修改它)。我尝试使用chmod命令更改文件权限,但没有任何反应。为什么对CodeIgniter.php文件的权限被拒绝?

回答by Satyam Singh

You need to change the permission of your TS_Project folder to 755.

您需要将 TS_Project 文件夹的权限更改为 755。

You can do that by:

你可以这样做:

sudo chmod -R 755 /opt/lampp/htdocs/TS_Project

sudo chmod -R 755 /opt/lampp/htdocs/TS_Project