Plesk

How to change date.timezone parameter for PHP?

Question

How to change default date.timezone parameter for particular PHP version for all domains at once or for a certain domain?

Answer

For all domains on a PHP handler

  1. Login to Plesk
  2. Click on required PHP version in Tools & Settings > PHP Settings. For example, 7.2.20 FastCGI application:
    border_plus_Screenshot.png
  3. Open PHP configuration file (php.ini tab):
  4. Browse to date.timezone parameter, remove ; sign before it and specify parameter according to PHP official requirements:

    For example:

    date.timezone = Europe/London

  5. Click OK button: all required services will be restarted automatically and changes will be applied to all domains assigned to this PHP handler. 

For a certain domain

  1. Login to Plesk
  2. Go to Domains > example.com > PHP Settings.

  3. Specify a time-zone in the Additional configuration directives field. The list of supported time-zones is available here. For example:

    date.timezone = Europe/London

  4. Apply the changes. The changes may be verified in domain's php.ini by clicking on View the phpinfo() page

CLI solution for all domains on a PHP handler

  1.  Connect to the server via SSH
  2. Run this command for a certain PHP handler, 7.4 in this example:

    # echo "date.timezone = Asia/Tokyo" >> /opt/plesk/php/7.4/etc/php.ini