Search code examples
nitrousio

Setting PHP CLI timezone


I have added my timezone to date.timezone in ~/.parts/etc/php5/php.ini but my PHP script that I execute on the console keep saying

We selected the timezone 'UTC' for now, 
but please set date.timezone to select your timezone.

Is there any solution for this?

UPDATES:

  1. I found out that PHP on Apache recognize my setting in php.ini but PHP command line is not.
  2. Somehow now it's working. I accept @carousel answer because I think it is informative for others.

Solution

  • Try with:

    date_default_timezone_set 
    

    method, which is used by all date/time functions.

    UPDATE:

    With PHP date/time settings you have to be very explicit, and don't rely on some predefined settings.