5

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.

neoteknic
  • 1,930
  • 16
  • 32
Jordan D
  • 718
  • 7
  • 21
  • `mcrypt` will be removed in PHP 7.2. The library is deprecated, not the manner of encryption. use [openssl](http://php.net/manual/en/book.openssl.php). – Xorifelse Feb 03 '17 at 12:02
  • ok, do you know what I can do to upgrade Laravel 4.2 so that it works? – Jordan D Feb 03 '17 at 12:04
  • 1
    It'd be best to upgrade to Laravel 5 *or* opening a GitHub issue – manniL Feb 03 '17 at 12:14
  • Possible duplicate of [Laravel requires the Mcrypt PHP extension](http://stackoverflow.com/questions/16830405/laravel-requires-the-mcrypt-php-extension) – Narf Feb 03 '17 at 13:19
  • That's using php 5.x, it's a different issue, I'm using MAMP's php, my .bash_profile looks like this; alias phpmamp='/Applications/MAMP/bin/php/php7.1.0/bin/php' export PATH=/Applications/MAMP/bin/php/php7.1.0/bin:$PATH – Jordan D Feb 03 '17 at 13:37
  • 2
    Your Laravel version uses mcrypt. PHP has deprecated it. Laravel needs to be updated, or you need to stick to PHP versions which are compatible with your Laravel version. Not sure what else there is to say about this. – deceze Feb 03 '17 at 13:42
  • I think you can use OpenSSL instead, which I've been trying to use, but I've been running into different issues, it'd be great if someone could highlight the steps required to make that work. Upon attempting to install it I'm getting 'Class 'Neoxia\LaravelOpensslEncryption\LaravelOpensslEncryptionServiceProvider' not found'. I've added the package to my composer.json, done a composer dump-autoload and tried running composer update and composer install but it still doesn't seem to be working... See here; https://github.com/neoxia/laravel-openssl-encryption/issues/2 – Jordan D Feb 03 '17 at 13:46

1 Answers1

5

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.

neoteknic
  • 1,930
  • 16
  • 32