5

When I run my CakePHP application on localhost Ubuntu 14.04 (LAMP) I get this error:

Warning: _cake_core_ cache was unable to write 'cake_dev_en-us' to File cache in /var/www/html/tmc/lib/Cake/Cache/Cache.php on line 328

Warning: /var/www/html/tmc/app/tmp/cache/persistent/ is not writable in /var/www/html/tmc/lib/Cake/Cache/Engine/FileEngine.php on line 385

Fatal error: Uncaught exception 'CacheException' with message 'Cache engine "_cake_core_" is not properly configured. Ensure required extensions are installed, and credentials/permissions are correct' in /var/www/html/tmc/lib/Cake/Cache/Cache.php:186 Stack trace: #0 /var/www/html/tmc/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('_cake_core_') #1 /var/www/html/tmc/app/Config/core.php(386): Cache::config('_cake_core_', Array) #2 /var/www/html/tmc/lib/Cake/Core/Configure.php(72): include('/var/www/html/t...') #3 /var/www/html/tmc/lib/Cake/bootstrap.php(431): Configure::bootstrap(true) #4 /var/www/html/tmc/app/webroot/index.php(97): include('/var/www/html/t...') #5 {main} thrown in /var/www/html/tmc/lib/Cake/Cache/Cache.php on line 186

I am not sure where is the issue. I tried sudo chmod 775 /var/www/html/tmc/lib/Cake/Cache/Engine/FileEngine.php command but it didn't fix the issue.

Kunok
  • 8,089
  • 8
  • 48
  • 89
  • Possible duplicate of [Cakephp cake\_core\_ cache was unable to write 'cake\_dev\_en-us'](http://stackoverflow.com/questions/18220128/cakephp-cake-core-cache-was-unable-to-write-cake-dev-en-us) – AD7six May 30 '16 at 13:55
  • `I tried sudo chmod 775 .../FileEngine.php` Did you really expect that to do anything, I think you misread the error message; this is pretty unambiguous `Warning: .../tmp/cache/persistent/ is not writable` – AD7six May 30 '16 at 13:55
  • The webserver needs write access to the tmp folder, answer is below – Colonel Mustard May 31 '16 at 21:53

1 Answers1

8

If you're running apache or nginx (fast-cgi) as user www-data that user should be the owner of the file:

cd /var/www/html/tmc/app;

find tmp -type d -print0 | xargs --no-run-if-empty -0 chmod 2755;
find tmp -type f -print0 | xargs --no-run-if-empty -0 chmod 0644;

chown -R www-data:www-data tmp;
tersmitten
  • 1,310
  • 1
  • 9
  • 23