Topic on Project:Support desk

Jump to navigation Jump to search

Need some help with upgrading mediawiki

17
Pritesh j thakkar (talkcontribs)

We are currently running following version, plan is to move mediawiki to CentOS 7 and upgrade mediawiki. Can you please guide me which version I should upgrade to first before latest LTS version ? and how can i upgrade it ?

Product Version
MediaWiki 1.15.4
PHP 5.3.3 (apache2handler)
MySQL 5.1.73

Thanks,

Fokebox (talkcontribs)

First of all try to follow official guidance on upgrading. If you face any difficulties, drop a message here.

P.S. I believe you will have some difficulties as you MW version extremely old, so probably you should ugrade step by step to newer version like from 1.15. to 1.20 to 1.25 to 1.30. etc.

Pritesh j thakkar (talkcontribs)

@Jonathan3 @Fokebox

Can you please have a look at following approach and tell me if I should be doing it differently ?

- I have built new centos 7 server and installed following packages :

httpd php php-mysql php-gd mariadb-server php-xml php-intl mysql

- export db from old server, and import it on new server, bring mediawiki code (/var/www/wiki) and save it on new server

- After 1.15 next LTS version is 1.19 so download that code. Backup existing mediawiki dir, untar new mediawiki release, copy LocalSettings.php from backup and test

Is there any document I can follow for step upgrade ?

Jonathan3 (talkcontribs)
Jonathan3 (talkcontribs)

Yes, there's a new note on that page saying: "Since Version 1.36, MediaWiki only commits to supporting upgrades from two LTS releases ago (see phab:T259771). Upgrades from older versions of MediaWiki will have to be performed in multiple steps. This means that if you want to upgrade to 1.36 from 1.23 or earlier, you'll first have to upgrade your 1.23 wiki to 1.27 (or 1.35), and, from 1.27 (or 1.35), you'll be able to upgrade to 1.36."

Jonathan3 (talkcontribs)

Looking at it again, to me this sentence is nonsense (i.e. I can't make sense of it!)

[Edit, since indentation didn't work as I had expected: I mean the sentence beginning "Since Version 1.36, MediaWiki only commits to supporting upgrades from two LTS releases ago..."]

Looking at task T259771, it says: "Also, everything up to 1.35 can still be done in one step. So someone who, in four years, wants to upgrade from 1.29 to 1.43, will have to do two steps: one to 1.35, and one to 1.43. To upgrade to 1.50 in seven years, you'd go from 1.29 to 1.35 (2020), then to 1.43 (2024), and finally to 1.50 (2027). Not too terrible, I think."

So it looks like you could go straight from 1.15 to 1.35. You couldn't go from 1.15 to 1.36 though. You might as well go straight to 1.35, then 1.36, as then you don't have to mess around with different PHP versions etc.

This post was hidden by Pritesh j thakkar (history)
Jonathan3 (talkcontribs)

Maybe that's a php version thing. You don't need to move the old wiki php files across. Just the database plus a selection of files (localsettings.php etc). You download the new mediawiki files from the tarball, then copy across those selected files.

Pritesh j thakkar (talkcontribs)

@Jonathan3 @FokeboxI just tried to upgrade to mediawiki-1.35.3.tar.gz, but now home page isn't displaying (blank page). And php update.php, is not showing any output and exit code is 255.

I have upgraded php to PHP 7.4.23, can you please advise how I can fix that ?


Thanks,

Jonathan3 (talkcontribs)

I'm only another user. But what exactly have you done (ie every step)?

Pritesh j thakkar (talkcontribs)

I have documented steps as I was upgrading it :


tar -xvzf ~pritha1/mediawiki-1.35.3.tar.gz

mv mediawiki-1.35.3/ wiki

cp -ip wiki_WORKING/LocalSettings.php wiki

cp -prv ../wiki_WORKING/images .

php update.php

PHP Parse error:  syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/wiki/maintenance/update.php on line 131

php --version

PHP 5.4.16 (cli) (built: Apr  1 2020 04:07:17)

Copyright (c) 1997-2013 The PHP Group

Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

After upgrading

[root@psapql427 yum.repos.d]# php --version

PHP 7.4.23 (cli) (built: Aug 24 2021 16:33:30) ( NTS )

Copyright (c) The PHP Group

Zend Engine v3.4.0, Copyright (c) Zend Technologies

[root@psapql427 maintenance]# php update.php

Error: Missing one or more required components of PHP.

You are missing a required extension to PHP that MediaWiki needs.

Please install:

* mbstring <https://www.php.net/mbstring>

yum install php74-php-mbstring.x86_64

php update.php

echo $?

255

I really appreciate for helping me with it.

Thanks,

Jonathan3 (talkcontribs)

This is a wild guess, but maybe the update script did some stuff during the first two attempts, and its half-done job is now causing problems.

Until you hear form someone else, what about just starting from scratch (i.e. copy across your database, new MW 1.35 files, and LocalSettings and images, then run update.php)?

Or what about commenting out all the extension lines in LocalSettings.php? That changed from "include" to "wfLoadExtension".

Or what about installing a brand new MW1.35 purely to obtain a new LocalSettings.php file? Then using that to recreate one for your actual wiki. Maybe something important has changed. I think a few old lines I had left over from MW1.5 or so caused me trouble recently.

Pritesh j thakkar (talkcontribs)

I have uninstalled PHP7.4 and refreshed db again and mediawiki 1.15 is working again.

"new MW 1.35 files, and LocalSettings and images, then run update.php)? " do I need to upgrade Php before doing that ?

php --version

PHP 5.4.16 (cli) (built: Apr  1 2020 04:07:17)

Jonathan3 (talkcontribs)

Yeah the MW1.35 files on the new server will need the new version of php etc.

Don't forget to follow the instructions rather than just my message :-)

12.68.235.100 (talkcontribs)

I am trying to upgrade to 1.35, ran php update.php and got following error. Have you ever seen that error before, if so please advise how I can get around it.

[root@<Host>maintenance]# php update.php

PHP Fatal error:  Uncaught Error: Class 'WebRequest' not found in /var/www/wiki/includes/HeaderCallback.php:63

Stack trace:

#0 [internal function]: MediaWiki\HeaderCallback::callback()

#1 {main}

  thrown in /var/www/wiki/includes/HeaderCallback.php on line 63

Fatal error: Uncaught Error: Class 'WebRequest' not found in /var/www/wiki/includes/HeaderCallback.php:63

Stack trace:

#0 [internal function]: MediaWiki\HeaderCallback::callback()

#1 {main}

  thrown in /var/www/wiki/includes/HeaderCallback.php on line 63


Thanks,

Pritesh

Ciencia Al Poder (talkcontribs)

This may happen if you unpack new files over an old installation, leaving old files behind. Try moving your old installation to a backup directory and unpack the new installation to a new and empty folder, restoring LocalSettings.php file from backup, uploads, and downloading any non-bundled extensions or skins.

Pritesh j thakkar (talkcontribs)

It is working now after making some puppet changes. thank you all for your help.