Setting the timezone on PHP

Versions of PHP after 5.10 include the date.timezone directive in php.ini. Many applications which reference time need this directive to be set. A list of accepted values can be found at:

The timezone is set as a quoted string, with no delimiter at the end, for example:

date.timezone = "Continent/City"

The location of the php.ini file that is in use can be found by loading a php file containing the following:

<?php phpinfo(); ?>

The resulting output will list, among other things, ‘Configuration File (php.ini) Path’ (typically, /etc).

Restart apache (or other server) for the changes to take effect:

service httpd restart

By cyberx86

Just a random guy who dabbles with assorted technologies yet works in a completely unrelated field.

Leave a comment

Your email address will not be published. Required fields are marked *