Function mcrypt_get_iv_size() is deprecated in Laravel 4.2 on MAMP running PHP 7.1.0

Jordan D picture Jordan D · Feb 3, 2017 · Viewed 8.7k times · Source

I've just upgraded my MAMP server to run 7.1.0. I'm now getting this error with my Laravel 4.2 installations;

Function mcrypt_get_iv_size() is deprecated 

I've tried changing

'cipher' => MCRYPT_RIJNDAEL_128,

to

'cipher' => 'AES-256-CBC',

but to no avail.

Does anyone know how to get around this issue in Laravel 4.2?

Not a duplicate as explained in the comments.

Answer

neoteknic picture neoteknic · Feb 3, 2017

You should upgrade you laravel project. mcrypt is deprecated in php 7.1.

You can just disable deprecated warning in your php configuration (or add @ before any mcrypt function), if you don't have time to upgrade.

Be carefull ! it will be completly removed in 7.2+

Edit: for php 7.2, it's removed in the core, but you can add mcryt as a pecl extension.