Jump to content

Topic on Project:Support desk

[RESOLVED] Installation, date_default_timezone_get error

15
173.71.49.60 (talkcontribs)

Mediawiki version: 1.20.2 Php version: 5.4 MySQL 5.0 (Hosted by 1and1.com)

ISSUE: I've tried installing MediaWiki twice now, and both times after installation, the following text is emblazoned on top of every page in the Wiki:

Strict Standards: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /homepages/36/d95221237/htdocs/edgelands/wiki/includes/Setup.php on line 431

What do I need to do to remove this error?

Thanks!

Ciencia Al Poder (talkcontribs)
Bawolff (talkcontribs)

Note: In theory MediaWiki should never output an E_STRICT error. Any such instance of MediaWiki doing so is technically a bug (albeit not one I would consider severe)

Ciencia Al Poder (talkcontribs)

Created bugzilla:43092 to try to issue a warning on install if E_STRICT is enabled in error_reporting.

108.16.41.98 (talkcontribs)

Meanwhile you can remove the error by making the following change in Setup.php line 431:

$wgLocaltimezone = 'America/New_York'; // $wgLocaltimezone = date_default_timezone_get();

Bawolff (talkcontribs)

Please don't modify Setup.php. Adding $wgLocaltimezone = 'America/New_York'; (Or whatever the timezone you want is) to the bottom of LocalSettings.php will accomplish the same thing, without modifying core files.

The issue in question (the warning) will be fixed in MediaWiki 1.21. You can also fix the issue by applying the one line fix to GlobalFunctions.php or just disabling E_STRICT warnings in your php.ini file.

Wikiwattwurm (talkcontribs)

Hi there, I ran into the same problem. Is there any V. 1.21 near the horizont?

I did a normal installation, but it shows this alert only: Quote: "Strict Standards: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /[path]/includes/Setup.php on line 431"

Modifications in the Setup.php oder LocalSetup.php did not work. Setup.php: "$wgLocaltimezone = 'Europe/Berlin'; // $wgLocaltimezone = date_default_timezone_get();"

or LocalSetting.php: "$wgLocaltimezone = 'Europe/Berlin';"

Wikiwattwurm (talkcontribs)

FYI, I downloaded and installed V. 1.21a, runns smoothly.

MarkAHershberger (talkcontribs)

MediaWiki 1.21 is set to be released later this spring. Probably late May.

213.183.181.74 (talkcontribs)

Believe it or not, but in the wiki I tried to setup, I had the error-message two times!

After setting ""$wgLocaltimezone = 'Europe/Berlin';" one disappeared. And a long search later I found the second "failure": It was hardcoded as HTML in the LocalSettings.php.

<br />
<b>Strict Standards</b>:  date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the 
date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. 
We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in <b>/homepages/....../includes/Setup.php</b> on line <b>431</b><br />
<?php
# This file was automatically generated by the MediaWiki 1.20.2
# installer. If you make manual changes, please keep track in case you
# need to recreate them later.
Ciencia Al Poder (talkcontribs)

The error message inside the LocalSettings.php is a funny one ;)

This happened because now it generates it for download, as if it is generating the HTML of any page, so if in normal pages the error message appears at the top, the same happens on the generated LocalSettings.php.

65.129.58.187 (talkcontribs)

I will second this post. I placed $wgLocaltimezone = 'America/New_York'; (changing it for my location) in the Localsettings.php and then deleted the content above <?php in the Localsettings.php file. All appears to work fine now.

Kev

95.223.171.157 (talkcontribs)

Thanx that was the solution. Deleting the error in LocalSettings.php and adding the timezone there.

FlightTime (talkcontribs)

I had the same issue, and was drafting a help request when I found Ciencia Al Poder's first reply above, which resolved the entire issue. Thank you very much.

103.17.82.165 (talkcontribs)

Change(ADD) in AppKernel.php file

public function init() {

        date_default_timezone_set('Asia/Kolkata');

        parent::init();

    }