Adjust PHP setting date.timezone

Preface

In PHP, the time zone UTC is used by default. If you want to use a different default time zone, this article will show you how to adjust the corresponding time zone globally or per domain.


We recommend saving the time in UTC in order to display it later on the basis of the user's current time zone.



Prerequisites

  • Access to the Plesk Control Panel



Customization for all domains

If you want to customize the PHP time zone globally (for a specific PHP version), click on "Tools & Settings" in the left sidebar in Plesk and then select "PHP Settings".



All installed PHP versions are visible on the following page. Please select the PHP version for which you would like to adjust the time zone.

After the selection, the php.ini must be edited. To do this, please click on the "php.ini" tab at the top


Now search for the configuration item date.timezone in the php.ini. You can click on the text field and then open the search with CTRL+F or Command+F.


Once you have found the point, adjust it according to your desired time zone. A list of all possible time zones can be found directly on the PHP page.


For our example, we will use the German time zone 'Europe/Berlin'.


To finally save the changes, click on the "OK" button


The time zone is now globally adjusted for this PHP version.


If you want to adjust the time zone for a different PHP version, you must repeat the above steps for the desired PHP version.



For a specific domain

If you only want to adjust the time zone for one domain, the procedure here is slightly different. To do this, click on "Websites & Domains" in Plesk and search for the domain in question. Under "Developer tools", please select "PHP".



In the PHP settings, please scroll to the very bottom to the item "Additional configuration instructions". The time zone must now be configured here. To do this, insert the following sentence into the text field: date.timezone = Europe/Berlin.

If Berlin is not the desired time zone, you will find a list of all possible time zones here.



Finally, please save the adjustments by clicking on "Apply". The time zone for the specific domain is then adjusted.