1

I have been using cakephp for many years so should be better than a novice. But today on a fresh install of cakephp-2.4.10, I got this error and cannot figure out how to solve:

Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /var/www/html/cakephp/lib/Cake/Cache/CacheEngine.php on line 60

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

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

Fatal error: Uncaught exception 'CacheException' with message 'Cache engine _cake_core_ is not properly configured.' in /var/www/html/cakephp/lib/Cake/Cache/Cache.php:181 Stack trace: #0 /var/www/html/cakephp/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('_cake_core_') #1 /var/www/html/cakephp/app/Config/core.php(373): Cache::config('_cake_core_', Array) #2 /var/www/html/cakephp/lib/Cake/Core/Configure.php(72): include('/var/www/html/c...') #3 /var/www/html/cakephp/lib/Cake/bootstrap.php(175): Configure::bootstrap(true) #4 /var/www/html/cakephp/app/webroot/index.php(90): include('/var/www/html/c...') #5 {main} thrown in /var/www/html/cakephp/lib/Cake/Cache/Cache.php on line 181

I have read Cakephp cake_core_ cache was unable to write 'cake_dev_en-us' but I have made sure: 1) /var/www/html/cakephp and everything beneath it is owned by apache.apache (My server is Fedora 19 with Apache 2.4, the httpd user is apache as verified by whoami); app/tmp and everything beneath has permission 777.

[root@localhost html]# ls -l cakephp/app
total 52
drwxrwxr-x. 3 apache apache 4096 May 18 10:31 Config
drwxrwxr-x. 4 apache apache 4096 May 18 10:31 Console
drwxrwxr-x. 3 apache apache 4096 May 18 10:31 Controller
-rw-rw-r--. 1 apache apache  695 May 18 10:31 index.php
drwxrwxr-x. 2 apache apache 4096 May 18 10:31 Lib
drwxrwxr-x. 3 apache apache 4096 May 18 10:31 Locale
drwxrwxr-x. 4 apache apache 4096 May 18 10:31 Model
drwxrwxr-x. 2 apache apache 4096 May 18 10:31 Plugin
drwxrwxr-x. 4 apache apache 4096 May 18 10:31 Test
drwxrwxrwx. 6 apache apache 4096 May 18 10:31 tmp
drwxrwxr-x. 2 apache apache 4096 May 18 10:31 Vendor
drwxrwxr-x. 9 apache apache 4096 May 18 10:31 View
drwxrwxr-x. 6 apache apache 4096 May 18 10:31 webroot

Going down tmp is the same, all drwxrwxr-x

What have I missed?

Community
  • 1
  • 1
cpliu338
  • 645
  • 1
  • 7
  • 20
  • 1
    `Warning: tmp/cache/persistent/ is not writable` can only mean the folder doesn't exist or the webuser cannot write to it. There is nothing in the question to suggest this question is any different than existing questions asking the same thing. – AD7six May 20 '14 at 09:45

2 Answers2

1

My silly mistake. I forgot to disable SELinux. But the error should be more precise, I think.

cpliu338
  • 645
  • 1
  • 7
  • 20
0

You can set the date.timezone value in your php.ini file.

http://kb.siteground.com/datetimezone_value_in_php/

Or if you can't edit your ini file then try define date_default_timezone_set('Your timezone');

http://php.net/manual/en/function.date-default-timezone-set.php

filype
  • 8,034
  • 10
  • 40
  • 66
  • Thx Filype, I'll do that later. But my question is "Cannot write to Cache" CacheException – cpliu338 May 20 '14 at 08:53
  • how does tmp/cache and tmp/cache/persistent look like? are the permissions ok? – filype May 20 '14 at 09:05
  • drwxrwxrwx. 5 apache apache 4096 May 18 10:31 cache – cpliu338 May 20 '14 at 09:36
  • drwxrwxrwx. 2 apache apache 4096 May 18 10:31 persistent – cpliu338 May 20 '14 at 09:37
  • @cpliu338 if you wanted to ignore the first error (it's really trivial to address - just [open your `Config/core.php` file](https://github.com/cakephp/cakephp/blob/2.4.9/app/Config/core.php#L266-L270)) - why did you include it in the question? Ignoring errors/warnings is a very bad habit. – AD7six May 20 '14 at 09:46
  • I have edited php.ini with a valid timezone. The first warning is gone, but still stuck in the CacheException – cpliu338 May 20 '14 at 11:22