40 likes | 51 Views
Default timezone in Apache/PHP is set to UTC time. Here is how to change default timezone in Apache/PHP. #apache #php<br><br>Visit https://ubiq.co/tech-blog/how-to-change-default-timezone-in-apache-php/
E N D
Change default timezone using .htaccess file Open .htaccess file, typically located at /var/www/html/.htaccess $ sudo vi /var/www/html/.htaccess Add the following line to set environment variable TZ (for timezone) in Apache web server to Eastern Time zone in US. SetEnv TZ America/New_York Restart Apache Server to apply changes. $ sudo service apache2 restart
Change default timezone using php.ini Open php.ini, typically at /etc/php.ini $ sudo vi /etc/php.ini Uncomment/Add the following lines to set default timezone in PHP. ;[Date] ;date.timezone = UTC Change them to the following, to set default time to Eastern timezone. [ Date] date.timezone = America/New_York Restart Apache Server to apply changes. $ sudo service apache2 restart
Thank You Visit for details https://ubiq.co/tech-blog/how-to-change-default-timezone-in-apache-php/