Topic on Project:Support desk

help with this: Fatal error: mcrypt_create_iv()

29
189.237.51.67 (talkcontribs)

Hi, i'm trying to install mediawiki 1.18.2, using a MySQL 5.0 database, and when i start, before getting complete it shows me this error.


Fatal error: mcrypt_create_iv() [<a href='function.mcrypt-create-iv'>function.mcrypt-create-iv</a>]: Could not gather sufficient random data in D:\Hosting\9176902\html\web\mediawiki-1.18.2\includes\CryptRand.php on line 281


could someone help me with that?

Jasper Deng (talkcontribs)

A pretty common error lately. Second time I've seen problems with people being unable to use a randomization function during installation.

189.237.51.67 (talkcontribs)

I see, do you know how could I solve it? or complete the installation?

Jasper Deng (talkcontribs)

Try an earlier version of MediaWiki like 1.18.0 (which works for me), or trunk (1.20alpha).

189.237.51.67 (talkcontribs)

I'll try that, thanks

Jasper Deng (talkcontribs)

But I'll warn you that this is a pretty rampant bug. There's another thread on this support desk about it.

189.237.51.67 (talkcontribs)

btw, where can I find the 1.18 version, as page only shows 1.18.2 ?

Jasper Deng (talkcontribs)

Damn. It looks like you'll have to go w/ 1.17.3 then :( I lied

See .

Bawolff (talkcontribs)

ugh, that's a horrible reason to create a fatal error /me glares at php.

Reedy (talkcontribs)

What version of PHP?

189.237.51.67 (talkcontribs)

it's PHP 5.3, i tried with 1.18 and 1.17 and it still showing the same error.

Reedy (talkcontribs)

Yeah, they've both got the same code. It's a PHP related issue though...

189.237.51.67 (talkcontribs)

so, there is no solution for that problem yet? does someone know how to fix it?(instead of the options showed on this post, as they don't woek)

Bawolff (talkcontribs)

Well work around is to use 1.18.1 (note .1 not .2. It can be downloaded from http://svn.wikimedia.org/svnroot/mediawiki/tags/REL1_18_1/phase3/ . If you don't have an svn client to download it though, it will be a pain to download). Note however this is missing some security fixes, and is insecure (The issue you're experiencing is the patch to make stuff secure gone slightly wrong).

68.48.41.114 (talkcontribs)

Having the same problem. Tried with 1.18.1 and 1.18.2. Nothing works! Anyone able to find a way around this?

68.48.41.114 (talkcontribs)

Tried with two other builds, alpha and beta. Still giving same error: "Could not gather sufficient random data in ....\includes\CryptRand.php on line 281". I guess this is a major issue. Did anyone have any luck with this?

68.48.41.114 (talkcontribs)

Oh, I am using PHP 5.3 and MySQL 5 btw.

Jasper Deng (talkcontribs)

What kind of webhost do you have? The PHP had better be later or earlier than 5.3.1.

68.48.41.114 (talkcontribs)

I am using GoDaddy Deluxe Hosting.

Jasper Deng (talkcontribs)

Hhm... Check your Special:Version. If it says "fast-cgi" or any other thing mentioning "cgi" for your PHP, then you have Windows IIS. I don't know about it, but GoDaddy just might restrict the required functions, as many webhosts tend to do so, but I doubt that for such a basic and fundamental function like the randomization functions.

68.48.41.114 (talkcontribs)

I just started out with this host so I can switch operating systems relatively quickly. I am migrating from Windows to Linux right now. I'll see if that makes a difference.

Bawolff (talkcontribs)

Note, fast-cgi can be used under linux, its just not anywhere near as popular. Generally you'd get a different error message if your host is the one restricting the function.


I wonder if this entire thing is a typo in php source. They have the exact same error in two place, in one place its a warning, in the other its a fatal.

Bawolff (talkcontribs)

Tried with two other builds, alpha and beta. Still giving same error: "Could not gather sufficient random data in ....\includes\CryptRand.php on line 281". I guess this is a major issue. Did anyone have any luck with this?

If you get that error message when using 1.18.1 then you did something wrong (Since CryptRand.php doesn't exist in 1.18.1). So if you get that error message, then you're not actually using 1.18.1.

Bawolff (talkcontribs)

Alternative work around (Note, this will potentially make your wiki somewhat less secure. I'm not exactly sure how much less secure (or more generally what the security implications actually are. You may want to modify $wgSecretKey in your LocalSettings.php to make it more random after your done the install if you do this)

  • Locate the file includes/CryptRandom.php.
  • Find the following line (probably around line 289):
$iv = mcrypt_create_iv( $rem, MCRYPT_DEV_URANDOM );
  • Change it to:
$iv = mcrypt_create_iv( $rem, MCRYPT_RAND );

See if things work (Make sure to do a hard refresh of the install page/re-start the install). I'm not sure if this will work, so i'd be very interested to hear if that actually fixes the issue.

Iankarlwallace (talkcontribs)

New to MediaWiki but the change for MCRYPT_DEV_URANDOM to MCRYPT_RAND allowed me to generate the LocalSettings.php file and finish my install.

Not sure how it effects the actual security/randomness but I am at least able to use the wiki.

122.162.138.75 (talkcontribs)

Thanks that really worked for me. I am using windows hosting of godaddy. after changing this installation get completed. I am using the latest release of media wiki.

130.85.242.227 (talkcontribs)

Bawolff, you are right, I had uploaded the wrong files by mistake, when trying to upload 1.18.1.

Your changes above fixed my problems as well. Thank you!

189.237.51.67 (talkcontribs)

I just asked to Godaddy support to help me with the installation (that's my Hosting provider), and they did, but they told me it was a a problem between PHP and wiki PHP, but it was only at windows servers, as on Linux it doesn't have any problem.

Onu~mediawikiwiki (talkcontribs)

I got this error on my Windows 2003 system when I upgraded to MediaWiki 1.19.1 (from MediaWiki 1.18.0) with these components:

  • IIS 6
  • FastCGI 1.5
  • PHP 5.3.3 (Non Thread Safe VC9)
  • PostgreSQL 9.0.0-1

The error was resolved when I upgraded to PHP 5.3.16 (Non Thread Safe VC9).

This post was posted by Onu~mediawikiwiki, but signed as Onu.

Reply to "help with this: Fatal error: mcrypt_create_iv()"