简体   繁体   English

CodeIgniter错误403在Ubuntu上禁止访问

[英]CodeIgniter error 403 Access forbidden on Ubuntu

I've been working on not-much-complicated projects using CodeIgniter on windows, but this is my first time to launch any php file in Ubuntu. 我一直在研究在Windows上使用CodeIgniter的非常复杂的项目,但这是我第一次在Ubuntu中启动任何php文件。

I copied a CodeIgniter project to /opt/lampp/htdocs which was working perfectly on windows but doesn't work on Ubuntu. 我将一个CodeIgniter项目复制到了/opt/lampp/htdocs ,它在Windows上完美运行但在Ubuntu上不起作用。 It gave me the 403 error. 它给了我403错误。

Solved: 解决了:

  1. Set permission from the command line: sudo chmod 777 -R /opt/lampp/htdocs then sudo chmod 777 -R /opt/lampp/htdocs/ PROJECT_FOLDER where PROJECT_FOLDER is the name of your project directory. 从命令行设置权限: sudo chmod 777 -R /opt/lampp/htdocs然后sudo chmod 777 -R /opt/lampp/htdocs/ PROJECT_FOLDER其中PROJECT_FOLDER是项目目录的名称。

  2. Make sure your controllers' name are capitalized. 确保您的控制器名称大写。

In addition to the good comments, apache needs execute access on every folder from root to the project in order to traverse the file system. 除了好的注释之外,apache还需要对从root到项目的每个文件夹执行访问,以便遍历文件系统。

sudo chmod +x /
sudo chmod +x /opt
sudo chmod +x /opt/lampp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM