LoginSignup
5
5

More than 5 years have passed since last update.

php.iniの置き場所

Last updated at Posted at 2014-04-07

cakephpを使ってwebアプリを作ろうと思ったら、導入して、とりあえず実行してみたら

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: 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

って警告されました。
なんのことかよくわからなかったのですが、

date_default_timezone_get()

使ってるけど、デフォルトのタイムゾーン設定してないじゃん
ってことらしい。
http://kforce-ueda.hatenablog.com/entry/2014/01/22/095059

なのでphp.iniのModule Settingなる場所をいじる必要があるらしく、php.iniを探そうとしたが場所がわからない。

なので調べるとどうやら、自動インストールした場合は

/etc/php.ini

にあるらしいので、

date.timezoneを変更しました。
http://oshiete.goo.ne.jp/qa/3220382.html

ちなみに
CacheEngin.phpを下記に書き換えました。
たぶん60行目くらいにあります。

if (!is_numeric($this->settings['duration'])) {
            date_default_timezone_set('Asia/Tokyo');
            $this->settings['duration'] = strtotime($this->settings['duration']) - time();
        }
        return true;
    }

この設定したら、いろいろエラーが解消しました。

5
5
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5