mzcoxfde mzcoxfde - 5 months ago 35
PHP Question

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.

I copied a CodeIgniter project to

/opt/lampp/htdocs
which was working perfectly on windows but doesn't work on Ubuntu. It gave me the 403 error.

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.

  2. Make sure your controllers' name are capitalized.


Answer

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.

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