Cannot Set date.timezone In php.ini file
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 !!! Setting the Timezone for PHP in the php.ini file
I tried all the other possible solutions posted, but none of them helped. This is what helped me save my timezone settings:
1) Go to your phpinfo()
page and search for Loaded Configuration File
and open the php.ini
file mentioned under that section.
2) Change the default timezone settings by adding your new timezone by modifying this line: date.timezone=Asia/Kolkata
.
3) Save the php.ini
file and stop the Apache server.
4) Restart the Apache server. The timezone settings should now be modified.
php.ini 'date.timezone' doesn't have any effect
In the comments, Minesh Patel told me to check if there is something overwriting my option, so I searched through my php.ini for Europe/Berlin
and it turns out there was another date.timezone
-entry that overwrote it.
Change to php.ini does not have effect
You can also set time zone from your script in case you don't have permission to restart the server:
<?php
date_default_timezone_set('America/Phoenix');
//rest of your code.
?>
And here the list of supported time zones by PHP.
Related Topics
How to Automatically Read in Calculated Values with PHPexcel
Using Moodle Create Users and Enroll Them in Courses via SQL
How to Retrieve Date from Table Cell Using PHPspreadsheet
PHP Fatal Error: Call to Undefined Function Imagettftext()
Get the Text of the Selected Option Using PHP
How to Refresh Select2 Dropdown Menu After Ajax Loading Different Content
PHP - Good Cronjob/Crontab/Cron Tutorial or Book
Woocommerce Cart Quantity Base Discount
Should a Function Use: Return Null;
In a PHP5 Class, When Does a Private Constructor Get Called
Storing Leading Zeros of Integers in MySQL Database as Integer
Rounding Up to the Second Decimal Place
Resource Interpreted as Image But Transferred with Mime Type Text/HTML - Magento