Cannot Set date.timezone In php.ini file
datetime, php, timezone
Solution
finally solved my problem, this is my Loaded Configuration File:
/etc/php5/apache2/php.ini
modified the date.timezone here but it's not working.
So, I check the "Scan this dir for additional .ini files " values in phpinfo() which point to:
/etc/php5/apache2/conf.d
then I search date.timezone from all files in that folder but found none.
this is my Additional .ini file parsed value in phpinfo():
/etc/php5/apache2/conf.d/05-opcache.ini, /etc/php5/apache2/conf.d/10-pdo.ini, /etc/php5/apache2/conf.d/20-json.ini, /etc/php5/apache2/conf.d/20-mysql.ini, /etc/php5/apache2/conf.d/20-mysqli.ini, /etc/php5/apache2/conf.d/20-pdo_mysql.ini, /etc/php5/apache2/conf.d/20-xdebug.ini, /etc/php5/apache2/conf.d/30-mcrypt.ini
I modified /etc/php5/apache2/conf.d/20-xdebug.ini, and appended this line:
date.timezone = Asia/Jakarta
very weird but this solved my problem !!!
Problem
I'm using php5.5 and getting this error whenever I used the date function in PHP: ``` Warning: phpinfo(): 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 /var/www/info.php on line 1 ``` the loaded configuration file is here: ``` /etc/php5/apache2/php.ini ``` so I changed the date.timezone setting into this: ``` [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = Asia/Jakarta ; http://php.net/date.default-latitude ;date.default_latitude = 31.7667 ; http://php.net/date.default-longitude ;date.default_longitude = 35.2333 ; http://php.net/date.sunrise-zenith ;date.sunrise_zenith = 90.583333 ; http://php.net/date.sunset-zenith ;date.sunset_zenith = 90.583333 ``` Then I restart the server: ``` sudo /etc/init.d/apache2 restart ``` but still getting this error, I tried to check the .ini file in the Additional ini file location but none of it is overriding the date.timezone setting I've checked the php.ini file permission, but still not working please guide me to solve this problem, thanks..