In this tutorial you will learn how to set PHP timezone on Ubuntu Server.
Code used during this tutorial:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# Set PHP timezone # Ubuntu Server system time and date timedatectl vi /var/www/http.liviubalan.com/index.php <?php var_dump(date('c')); var_dump(date_default_timezone_get()); phpinfo(); # Browse http://http.liviubalan.com/ # Watch values for "Default timezone" and "date.timezone" in "date" section # Edit php.ini # Values edited here applies to HTTP only, not for CLI sudo vi /etc/php5/apache2/php.ini date.timezone = "Europe/Bucharest" # Restart Apache2 sudo service apache2 restart # Watch values for "Default timezone" and "date.timezone" in "date" section # Watch values for "Default timezone" and "date.timezone" in "date" section php /var/www/http.liviubalan.com/index.php | less sudo vi /etc/php5/cli/php.ini date.timezone = "Europe/Bucharest" # Restart Apache2 sudo service apache2 restart # Watch values for "Default timezone" and "date.timezone" in "date" section php /var/www/http.liviubalan.com/index.php | less Useful links: http://php.net/manual/en/timezones.php |
Useful links:
http://php.net/manual/en/timezones.php