Answers for "php cannot set timezone"

PHP
3

php datetime set timezone

$date = new \DateTime();
$date->setTimezone(new \DateTimeZone('+0800')); //GMT
echo $date->format('Y-m-d H:i:s');
// 2020-11-20 15:23:49
Posted by: Guest on November-20-2020
0

time zone for php is not set (configuration parameter "date.timezone").

I had the same issue on Ubuntu 14.04.4 and I have the set the values in /etc/php5/apache2/php.ini as below.

You can also edit /etc/apache2/conf-enabled/zabbix.conf which is simlink to /etc/zabbix/apache.conf:

php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
php_value date.timezone Greece/Athens
Posted by: Guest on June-28-2021

Browse Popular Code Answers by Language