Topic on Project:Support desk

Upgrade Wiki from 1.18 to 1.22.4

12
Noham100 (talkcontribs)

after upgrading from 1.18 to 1.22.4 I recieve an errore notice, opening my site: "Warning: require_once() [function.require-once]: 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 'UTC' for 'UTC/0.0/no DST' instead in /home/dorotinf/public_html/wikigenia/includes/GlobalFunctions.php on line 2300

Parse error: syntax error, unexpected $end, expecting T_VARIABLE or '$' in /home/dorotinf/public_html/wikigenia/includes/GlobalFunctions.php on line 2300" Can anyone help resolve?

88.130.98.250 (talkcontribs)

Hi!

> We selected 'UTC' for 'UTC/0.0/no DST' instead in /home/dorotinf/public_html/wikigenia/includes/GlobalFunctions.php on line 2300

Please do not modify MediaWiki core files. Undo your changes and the syntax error will be gone.

To fix the timezone problem, set $wgLocaltimezone to a value, which fits your location. E.g.

$wgLocaltimezone = 'UTC';
date_default_timezone_set($wgLocaltimezone);

See, if the line date_default_timezone_set($wgLocaltimezone); is needed; I am not sure right now.

88.130.98.250 (talkcontribs)

After checking includes/Setup.php, I think that you do not need the line date_default_timezone_set($wgLocaltimezone);. Should you still get this timezone notice, you have most probably misspelled the timezone identifier.

Noham100 (talkcontribs)

Where do I find the file includes/setup.php?

Noham100 (talkcontribs)

Bellow is the Timezone function in Localsettings.php:

 #Set Default Timezone
$wgLocaltimezone = "America/Los_Angeles";
$oldtz = getenv("TZ");
putenv("TZ=$wgLocaltimezone");
 # Versions before 1.7.0 used $wgLocalTZoffset as hours.
 # After 1.7.0 offset as minutes
$wgLocalTZoffset = date("Z") / 60;
putenv("TZ=$oldtz");

$wgLocaltimezone = "Asia/Jerusalem";

You think I have to delete this function? Doesn't it adapt the time to the reigion I live in?

Noham100 (talkcontribs)

Thanks, but I didn't make any changes. I made the upgrade by extracting the ZIP file I downloaded from MediaWiki, and used the original adapted files from the previous revision. LocalSettings.php for example. how can I run the site and debug the exact location where it crushes?

88.130.98.250 (talkcontribs)

Two things:

  • Your above error looks like the file includes/GlobalFunctions.php has been changed on or around line 2300. This is the place where MediaWiki currently crashes. Core files should not be modified. Undo any changes you did.
  • It is enough to set $wgLocaltimezone once. Just remove all the lines you posted above.

Then set

$wgLocaltimezone = 'Asia/Jerusalem';
$wgLocalTZoffset = date("Z") / 60;

It is important to set $wgLocaltimezone first and then to use the date() function. For a list of possible time zone identifiers see http://en.wikipedia.org/wiki/List_of_zoneinfo_time_zones

Ciencia Al Poder (talkcontribs)

As explained in Manual:Upgrading, you should not unpack the new installation over the old one. You should unpack on an empty folder, and then copy the needed files (like LocalSettings.php, images... as explained there) to the new installation.

88.130.85.15 (talkcontribs)

What you say is right; strange errors can happen if you don't put the new files in a new folder (meaing: if you still have files from old MediaWiki versions in the folder). But I am not sure, if this is the problem here...

Ciencia Al Poder (talkcontribs)

Yes, the timezone thing shouldn't be caused by this, but the "Parse error" is strange since that line doesn't contain anything special to cause this error, and may be caused by an incompete upload of those files.

88.130.85.15 (talkcontribs)

That is possible, but since he wrote "We selected 'UTC' for 'UTC/0.0/no DST' instead in /home/dorotinf/public_html/wikigenia/includes/GlobalFunctions.php on line 2300", my guess still is that he modified this place of the file (maybe to "fix" the timezone error and that a syntax error was added at that point).

Noham100 (talkcontribs)

Thanks for your asitance. The problem was that after upgrading MediaWiki you have sync LocalSettings with all updated extensions.

Reply to "Upgrade Wiki from 1.18 to 1.22.4"