2

I tried to install CakePHP on my home Ubuntu 10.04 desktop for development/testing purposes, and I believe I have gone through all the appropriate steps. However, I am still running into the problem that my layout is broken. I believe this is a DocumentRoot or mod_rewrite problem, but I don't have enough experience in Apache to diagnose and fix it.

  /var/www/cakephp/.htaccess
  1 <IfModule mod_rewrite.c>
  2    RewriteEngine on
  3    RewriteRule    ^$ app/webroot/    [L]
  4    RewriteRule    (.*) app/webroot/$1 [L]
  5 </IfModule>

  /var/www/cakephp/app/webroot/.htaccess
  1 <IfModule mod_rewrite.c>
  2     RewriteEngine On
  3     RewriteCond %{REQUEST_FILENAME} !-d
  4     RewriteCond %{REQUEST_FILENAME} !-f
  5     RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
  6 </IfModule>

Firebug gives this: 404 Not Found

Not Found

The requested URL /cakephp/css/cake.generic.css was not found on this server.


Apache/2.2.14 (Ubuntu) Server at localhost Port 80

I tried setting the permissions of css/ and cake.generic.css to 775. owner is www-data, which is right. tmp is writable too

I also can't access the directory from my browser, 404.

0x1F602
  • 865
  • 5
  • 22
  • It's more likely an .htaccess problem. Can you post your document root .htaccess, as well as your webroot .htaccess? – mway Oct 08 '10 at 05:44
  • 1
    @0X90: I see this more related to permission setting issues. Now that you see the page, can you use Firefox's extension HttpFox to inspect on the elements and see which is not present? – Michael Mao Oct 08 '10 at 05:47
  • @0x90: there you go, you don't have setup the correct permission for the css directory I am afraid... This file is static, so you can locate its path and chmod :) – Michael Mao Oct 08 '10 at 06:02
  • drwxrwxr-x 2 www-data root 4096 2010-09-12 03:57 css – 0x1F602 Oct 08 '10 at 06:09
  • 1
    can your css file be accessed with `/cakephp/app/webroot/css/cake.generic.css`? – Young Oct 08 '10 at 07:31
  • @SpawnCxy Yes it can... hmmm. Is this a DocumentRoot problem, then? – 0x1F602 Oct 08 '10 at 20:35

2 Answers2

1

but that will change your default website doccument starting point for your localhost site. if you add more sites to apache2, you'll have errors.

you might want to save your 000-default as a separate file

 /etc/apache2/sites-available/cakephptesting

and configure that file with the proper docroot

and then edit your host file

 /etc/hosts 

and add an entry as

 127.0.0.1 cakephptesting

that will allow you to access the site in a browser at http://cakephptesting

Steve Wasiura
  • 768
  • 1
  • 8
  • 19
0

I found the solution. I had to go under /etc/apache2/sites-enabled/000-default and change DocumentRoot to /var/www/cakephp/app/webroot

Now everything loads fine. Thanks!

Sorry,
Signed,
The Apache2 Noob :)

0x1F602
  • 865
  • 5
  • 22