Topic on Project:Support desk

Problems importing

11
Summary by Ciencia Al Poder
99.239.209.93 (talkcontribs)

I managed to get MediaWiki working earlier this morning and everything appears to working fine but I'm having problems trying to import files. These are the errors I'm constantly getting:

Warning: XMLReader::open() [xmlreader.open]: Unable to open source data in /www/zxq.net/h/e/l/helsinkipedia/htdocs/wiki/includes/Import.php on line 53

Warning: XMLReader::read() [xmlreader.read]: Load Data before trying to read in /www/zxq.net/h/e/l/helsinkipedia/htdocs/wiki/includes/Import.php on line 399

I've searched online and through the manual for hours and I can't seem to find a solution to this. The page itself also seem to display properly (the error message kind of sits in the background messing up the layout a bit) and another error pops up saying the upload failed but the wording is incomplete (Import failed: Expected <mediawiki> tag, got). Is there something wrong with Import.php or the XML file itself? I'm running MediaWiki 1.19.2 on the web host Zymic.com who uses the most recent version of PHP. The backup was done by me through Special:Export on Wikkii if that helps any. I'm new to managing MediaWiki software so I apologize if my question seems silly.

Ciencia Al Poder (talkcontribs)

If you're importing the XML dump through Special:Import, the problem may be that the xml uploaded never gets stored on the server so MediaWiki could open it for reading. Causes may be:

  • The XML is too large, larger than the MAX_UPLOAD_SIZE or MAX_POST_SIZE defined in the php.ini
  • The temporal folder configured in php.ini for uploads is misconfigured, does not exist, the web server has no permissions to write, etc.

If the problem is the first one, try to import a small one (an export of a single page, for example). If that works, you could separate the exported XML into smaller parts, or upload it to the server through ftp and use the maintenance script importDump.php on the server (requires shell access).

70.26.31.112 (talkcontribs)

Thanks for the response!

It's definitely not the first option as the import I'm doing is only 12 KB (the test file of course was even smaller). How would I go about the second option? Because I'm afraid I don't have access to php.ini.

88.130.67.118 (talkcontribs)

You can check the temp folder for uplaods by uploading a file to your server, lets say called "p.php" with the following content:

<?php phpinfo(); ?>

View the file with your webbrowser and you will be able to see all PHP settings and their values.

.alyn.post. (talkcontribs)

I have encountered exactly this problem, shortly after Wikipedia enabled Lua scripting through the Scribunto extension. Now importing a template (in my case, Template:Cite web) creates this problem on import. I assume the truncation "tag, got" is referring to a component incorrectly translating/transforming the input in some way, leading to an empty string. Rather than, I presume, a valid import value.

That's not a lot to go on, particularly as your problem precedes (I think?) the Scribunto extension.

2.122.191.243 (talkcontribs)

I installed a MediaWiki on my PC (personal wiki). I noticed that this problem happened if I attempted to import a large file and the system timed out. So first I got this message: "Fatal error: Maximum execution time of 30 seconds exceeded in C:\EasyPHP\www\wiki\includes\db\DatabaseMysqli.php on line 39".

Then each subsequent attempt of importing returned the message "Import failed: Expected <mediawiki> tag, got". The trick was to restart the server after the time out. Which sorted out the "Import failed" message EVERY TIME.

Cavila (talkcontribs)

Thanks, simply restarting the server did, in fact, do the trick!

Mafi9 (talkcontribs)

I'm on a hosted server and facing the same import-error saying Import failed: Expected <mediawiki> tag, got. I already asked the host for a server restart and then the import actually worked again, but after a couple of minutes the error came up again. Is there a workaround on this?

According to this post (https://phabricator.wikimedia.org/T86036 ) the only way is to restart the server every time, which is a pitty on a hosted server.

Ciencia Al Poder (talkcontribs)

If you don't want to restart the server, you can write a php script that calls libxml_disable_entity_loader(false), and execute on the web server (not in command line). Alternatively, apply the patch in that phabricator task.

It should be fixed in MediaWiki 1.26

Mafi9 (talkcontribs)

Thanks again Ciencia for your support! I modified the patch a bit for my 1.23 MW and the error is finally gone! :-)

195.200.76.252 (talkcontribs)

Could be a character encoding issue with the XML. Try converting it to UTF-8 before importing.

(Topic might be dead, but posting this in case others run into the same problem. We did, and making sure the character encoding in the file was correct fixed it for us.)

Reply to "Problems importing"