cakephpubuntu-10.04

Facing a file permission error while running CakePHP in Ubuntu 10.4


I have installed CakePHP 2.0 framwork using steps below:

1. Start the terminal
2. sudo mkdir /var/www/cakephp
3.sudo cp -r ~/cakephp/* /var/www/cakephp

Change tmp folder permisssion

4. sudo chmod -R 777 cakephp/app/tmp

Enable mod-rewrite

5. sudo a2enmod rewrite

Open file /etc/apache2/sites-enabled/000-default and change AllowOverride None to AllowOverride All

6. sudo vim /etc/apache2/sites-enabled/000-default

Restart Apache

7. sudo /etc/init.d/apache2 restart

I opened my browser and typed address http://localhost/cakephp/ and I seaw this error message:

Warning: _cake_core_ cache was unable to write 'cake_dev_en-us' to File cache in /var/www /cakephp/lib/Cake/Cache/Cache.php on line 310
Warning: _cake_core_ cache was unable to write 'cake_dev_en-us' to File cache in /var/www/cakephp/lib/Cake/Cache/Cache.php on line 310
Warning: /var/www/cakephp/app/tmp/cache/persistent/ is not writable in /var/www/cakephp /lib/Cake/Cache/Engine/FileEngine.php on line 320
Warning: /var/www/cakephp/app/tmp/cache /models/ is not writable in /var/www/cakephp/lib/Cake/Cache/Engine/FileEngine.php on line 320
Warning: /var/www/cakephp/app/tmp/cache/ is not writable in /var/www/cakephp/lib/Cake /Cache/Engine/FileEngine.php on line 320


Solution

  • The command sudo chmod -R 777 cakephp/app/tmp only made tmp writable, you should make cache and it's subdirectories writable as well, otherwise Cake can't write the cache files to the cache directory in tmp.

    So, these directories should be writable:

    cakephp/app/tmp/cache
    cakephp/app/tmp/cache/persistent
    cakephp/app/tmp/cache/models
    

    Make sure the log directory is writable as well: cakephp/app/tmp/logs.