Timezone not working during Build


#1

Hi,

During my build it always fails due to the timezone error below:

php artisan migrate

Warning: date(): 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 /home/circleci/project/config/const.php on line 11

Current Timezone use for my application is Asia/Tokyo

Config file used:
version: 2

jobs:
build:

docker:
  - image: circleci/php:5.6-node-browsers
  - image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: admin
      MYSQL_DATABASE: fellowes
      MYSQL_ROOT_HOST: 127.0.0.1
      TZ: "/usr/share/zoneinfo/Asia/Tokyo" 
environment:
  TZ: "/usr/share/zoneinfo/Asia/Tokyo" 
steps:
  - checkout

  - run: chmod -R 777 ./storage
  - run: mkdir bootstrap/cache

  - run: sudo apt-get update -y
  - run: sudo apt-get install -y libpng-dev libjpeg-dev zip unzip git
  - run: sudo rm -rf /var/lib/apt/lists/*
  - run: sudo docker-php-ext-install zip
  - run: sudo docker-php-ext-configure gd --with-jpeg-dir=/usr/lib/x86_64-linux-gnu/
  - run: sudo docker-php-ext-install pdo pdo_mysql gd mbstring zip
 
  - run: sudo composer self-update
  - restore_cache:
      keys:
        - composer-v1-{{ checksum "composer.json" }}
        - composer-v1-
  - run: composer install -n --prefer-dist
  - save_cache:
      key: composer-v1-{{ checksum "composer.json" }}
      paths:
        - vendor

  - run: cp .env.example .env
  - run: php artisan migrate
  - run: php artisan db:seed

  - run:
      name: Run PhpUnit
      command: ./vendor/bin/phpunit

#2

Any help would really be appreciated. Thanks!


#3

Try using just “Asia/Tokyo” for your TZ environmental variables.


#4