6

I installed laravel in my new pc and i'm getting this error:

ErrorException mcrypt_get_iv_size(): Module initialization failed

I copied the project from my old pc. mcrypt is installed and enabled, and other pages that do not use laravel are working. I'm running ubuntu 14.04

I created a new laravel project (using laravel new command) and when i try to access i get:

"Whoops, looks like something went wrong."

I opened the log and the error was:

production.ERROR: exception 'ErrorException' with message 'mcrypt_get_iv_size(): Module initialization failed

any ideas?

Laurence
  • 58,936
  • 21
  • 171
  • 212

4 Answers4

11

On app/config/app.php just change: 'cipher' => MCRYPT_RIJNDAEL_256,

RaySaraiva
  • 383
  • 2
  • 5
  • 2
    This answer actually worked for me. I had changed the cipher to AES 256 trying to get Laravel 5.0 to work with php7, but eventually fell back to php 5.6. Having made the cipher change earlier thus stopped mcrypt from initializing. This whole thing was thrown out after L5.0 as PHP depreciates this whole encryption layer at 7.0 and will remove it as of 7.2 – Watercayman Apr 06 '17 at 18:17
3

Run php artisan key:generate on your command line to refresh your application key.

Then clear your cache and sessions and try again.

I had this same problem today, and it was because of how Laravel 4.2 uses the new encryption method.

Laurence
  • 58,936
  • 21
  • 171
  • 212
0

Make sure you run php 7.0, and add this string "MCRYPT_RIJNDAEL_256" (without the quotes) to the cipher in app.php. after generate a new key (php artisan key:generate) and add the new key. This works for me.

Dennis Schaffer
  • 556
  • 7
  • 17
0

Another solution:

  • Add "tomgrohl/laravel4-php71-encrypter": "^1.1" to the require of your composer.json
  • Run composer update
  • Add 'AES-256-CBC' to the cipher in app/config/app.php

Done!

Samuel De Backer
  • 3,404
  • 2
  • 26
  • 37