skip to Main Content

I have my own digitalocean droplet setup and followed this tutorial to a T to get Cakephp working

Setup CakePHP with LAMP Stack

Everything works exactly as written in that tutorial besides for ‘Step 6’ – Creating the Article user interface. (Books in my case)

After using the bake all command and navigating to `/books’ I get a 404 not found

Showing CakePHP works by navigating to top level URL

Showing CakePHP doesn't work after navigating past the top level URL to /books

As you can see CakePHP is setup and working at the top level URL, however when trying to move past that to a Controller that definitely exists it can’t find it.

2

Answers


  1. Chosen as BEST ANSWER

    After some more digging, I found the issue. Apparently mod_rewrite is turned off by default on Ubuntu

    `sudo a2enmod rewrite
     systemctl reload apache`
    

    is the solution here


  2. Make sure your rewrite mod is On

    If you are using Linux goto /etc/apache2/sites-enabled -> open 000-default.conf file

    <VirtualHost *:80>
    ....
    
    // add these lines
    <Directory /var/www/html>
    #Options FollowSymLinks
       Options Indexes FollowSymLinks Includes ExecCGI
       AllowOverride All
       Order deny,allow
       Allow from all
    </Directory>
    
    ....
    <</VirtualHost>
    

    Save it.

    restart your server: sudo service apache2 restart

    give your project permissions by giving this command:

    sudo chown -R user_name:www-data project_name/
    sudo chmod -R 755 project_name/
    
    cd project_name 
    
    chown -R www-data tmp
    chown -R www-data logs
    
    chmod -R 777 tmp
    chmod -R 777 logs
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search