The default timezone for PHP is defined in php.ini configuration file. So you will need to edit the file by hand.
First, find the location of php.ini on your system as follows. In this example, it is found at /etc/php5/cli/php.ini.
Configuration File (php.ini) Path: /etc/php5/cli Loaded Configuration File: /etc/php5/cli/php.ini Scan for additional .ini files in: /etc/php5/cli/conf.d Additional .ini files parsed: /etc/php5/cli/conf.d/10-pdo.ini
Next, find out the timezone (TZ) string of your region. For that, you can use a command-line tool called tzselect. Simply run the following command:
After you are done, tzselect will print the value of TZ variable as follows. In this example, the TZ value is “America/New York”.
Now open up php.ini in a text editor, and look up “date.timezone” variable in it. If “date.timezone” variable definition is commented out, uncomment the line. Then change the timezone accordingly. You are done!
PS. If you like this post please share it with your friends on the social networks.Thanks.